Beginner - Where to put code to connect to database
Hi i've just started learning java recently and I have covered the basics constructors, getters, setters etc but I want to know how to connect to a database, i have the code for it but I do not know where to put the code. Would it go in a getter??? Sorry if this is a silly question but i am new to this
Re: Beginner - Where to put code to connect to database
You must put the code where you want to get connection to your database. And then simply try executing queries on the database through java and when you are done, close the connection. What's so hard?