wood burning stoves 2.0*
The moose likes JDBC and the fly likes JDBC MYSQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC MYSQL " Watch "JDBC MYSQL " New topic
Author

JDBC MYSQL

nirail rail
Ranch Hand

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

code
____________________________________________________________
String url = "jdbc :0racle:thin:@127.0.0.1:1521 :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 mysql.org. 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:
Class.forName("com.mysql.jdbc.Driver").newInstance();
and get a connection with something like:
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/test?user=root&password=");
David O'Meara
Rancher

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

Dave
 
 
subject: JDBC MYSQL
 
Similar Threads
id of the new field in my table
Jars and magic problems
jdbc IBM Rational Application Developer
how to put Chinese SQL query into mySQL????
My head hurts: JDBC + Java