Hey, I'm looking for decent MySQL tutorials for connecting a Database in Java. I'm using Java 8 so preferably would like tutorials that correspond with newest code.

Thanks!

Recommended Answers

The definitive Oracle tutorials are kept up to date, and include MySQL...
http://docs.oracle.com/javase/tutorial/jdbc/index.html
AFAIK there were no significant SQL-related changes in JDK 8.

Jump to Post

All 8 Replies

Re: Connecting MySQL with Java Tutorials? 80 80

Code is always the same because Java take care of backward compatibility.
Here you have tutorial about connection to database.
They explain every line of code what is made for.
Read that and I think you will not have any problems in future.
Kind regards, Mike.

Re: Connecting MySQL with Java Tutorials? 80 80

The definitive Oracle tutorials are kept up to date, and include MySQL...
http://docs.oracle.com/javase/tutorial/jdbc/index.html
AFAIK there were no significant SQL-related changes in JDK 8.

Re: Connecting MySQL with Java Tutorials? 80 80

my advice: learn to write your persistency code in such a way that it's not db dependent. it's much easier to work if on changing a db, all you need to do is change one single property, and not your actual code.

Re: Connecting MySQL with Java Tutorials? 80 80

^ like he said.
For learning, unles you are already a MySQL admin fiend, I can recommend using the JavaDB that came with your JDK, and NetBeans which has support for JavaDB burned in to its "services" tab. Setting up a database server isn't trivial unless you already know how how to do it. Using NetBeans/JavaDB will enable you to concentrate on your Java. Later you can change the connect statement to work with MySQL or whatever - the rest of the Java SQL support is database-independent.

Re: Connecting MySQL with Java Tutorials? 80 80

Just saw milil's post -
Beware that tutorial if you want current info. It starts with classForName, which became obsolete in 2006 (if not earlier).
Telling you to use classForName is a dead give-away for a tutorial that's not been updated for years and years.

Re: Connecting MySQL with Java Tutorials? 80 80

I figured I would use the Oracle tutorials as that would be the most official, and probably up to date tutorial.

I already have a MySQL server running a database and tables set up. I appreciate the advice however.

Re: Connecting MySQL with Java Tutorials? 80 80

Do I still need to download the JDBC Connector in order to connect to a MySQL database?

Re: Connecting MySQL with Java Tutorials? 80 80

For MySQL I think you need to download their JDBC connector, latest version here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.