wood burning stoves 2.0
The moose likes JDBC and Relational Databases and the fly likes how to connect mysql database? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "how to connect mysql database?" Watch "how to connect mysql database?" New topic

how to connect mysql database?

Markandey Sahu

Joined: Jun 29, 2006
Posts: 13
Can any one give me code for connecting mysql database?
Wich driver we can use for connecting database.
pls give me complete code..
Connection con =DriverManage.getConnection("???","??","??");
what i have to write in place of ???
Syskata Mitev
Ranch Hand

Joined: Aug 23, 2006
Posts: 51

database url : jdbc:mysql://localhost:3306/database_name

and check http://www.mysql.com/products/connector/j/ for connector downloading.

Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

Add your jconnector jar file to your classpath or copy it in your lib directory.

driverClass: com.mysql.jdbc.Driver

URL : jdbc:mysql://<serverhost:port>/<db name>

For more information, here is the URL

Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />prabhu.venkatachalam@gmail.com
I agree. Here's the link: http://aspose.com/file-tools
subject: how to connect mysql database?
It's not a secret anymore!