• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to connect mysql database?

 
Markandey Sahu
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one give me code for connecting mysql database?
Wich driver we can use for connecting database.
pls give me complete code..
Class.forName("???");
Connection con =DriverManage.getConnection("???","??","??");
what i have to write in place of ???
 
Syskata Mitev
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Class.forName("com.mysql.jdbc.Driver").newInstance();

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

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

4ng().live.healtly;
 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic