I’m trying to learn about database connectivity as it relates to Java EE development. I’ve followed several examples online that use Glassfish and Derby in eclipse. These examples are easy but they’ve left holes in my understanding of what is actually happening. Now I’m attempting to create a MySQL database independent of Eclipse and the whole framework THEN I will try and connect the two.
What is the difference between a MySQL database and a MySQL server? I see that they have both option from the website. Since I already have a web server in my Java EE project will I also need a database server or can I just install a “database” and let the Eclipse manage the connection?
You should first make sure you have downloaded and installed the Mysql server for their website http://dev.mysql.com/downloads/mysql/ once you download install it will will ask you to configure it which I suggest you do it is very simple and does not require any fancy knowledge. Then server will allow you to create as many databases as you wish.
Once the installer is completed you should have in your program files a link to the mysql command line enter your password and then you will be in with the root account.
will allow you to see the default databases. Do what ever SQL you need create table …. there and then from your code you will need to download a jar library http://dev.mysql.com/downloads/connector/j/ and then modify your code to connect using the JDBC driver.
This link is a very lengthy tutorial on how to use jdbc http://www.roseindia.net/jdbc/jdbc-mysql/ which seems to be what you need.
I personally always like coding myself and avoid being caught up in already made frameworks since you do not control everything. The frameworks might seems good but a year later when a new fancy requirement comes in it might just force you to start over again thats my 2 cens