• Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC with MYSQL  RSS feed

 
Patrick Mugabe
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers!
How do you load a driver when using MySQL as your database.
 
marko stone
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i do it like this
Class.forName("org.gjt.mm.mysql.Driver");
if (myCon==null)
{
myCon=DriverManager.getConnection("jdbc:mysql://database","username","password");
mySta=myCon.createStatement();
}
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!