This is from memory, and seeing what's on my system, as I'm not using MySQL atm ...
You download the Connector/J archive (tar.gz or zip, tar probably better) file from the MySQL web site.
Unpack it somewhere on your system. I have eclipse in /opt/eclipseNNN/eclipse and I put connector/J into /opt/eclipse351/mysql-connector-java-5.1.12/.
In your eclipse project, add (in project properties - java build path) the external jar which will be something like /opt/eclipse351/mysql-connector-java-5.1.12/mysql-connector-java-5.1.12-bin.jar.
Then in your class you need code like
Code:
String url = "jdbc:mysql://localhost:3306/" + dbname;
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection(url, username, password);