File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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 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 />
I agree. Here's the link:
subject: how to connect mysql database?
jQuery in Action, 3rd edition