File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes JDBC MYSQL Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply 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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: JDBC MYSQL
 
Similar Threads
id of the new field in my table
jdbc IBM Rational Application Developer
Jars and magic problems
how to put Chinese SQL query into mySQL????
My head hurts: JDBC + Java