It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes JDBC MYSQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC MYSQL " Watch "JDBC MYSQL " New topic


nirail rail
Ranch Hand

Joined: Nov 14, 2003
Posts: 39
we use following string in jsp/java code to connect to oracle

String url = "jdbc :0racle:thin:@ :0racleSID";

what code/string is used for MySql and which drivers are required for mysql

pls help
[ July 27, 2004: Message edited by: nirail rail ]
prem saggar
Ranch Hand

Joined: Aug 24, 2000
Posts: 66
Hi, I've done this, and I'm sure I got the complete information from Also, there are a bunch of tutorials out there. Google search = java jdbc mysql driver try. The try will probably garuntee you a code example . Happy hunting. Prem
Jonas Isberg
Ranch Hand

Joined: Mar 18, 2003
Posts: 118
I used the one found at:

Unpack the .jar file and make sure it is included in your CLASSPATH.

Load the driver with:
and get a connection with something like:
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/test?user=root&password=");
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Just for the record, you only need to put .instance() if you're using Java 1.1 or earlier, otherwise Class.forName(...) will be enough.

Only a small point and hardly worth mentioning, but sometimes its nice to know. It could save you from creating one whole instance

I agree. Here's the link:
subject: JDBC MYSQL
It's not a secret anymore!