• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to set property of jdbc?

 
Jeffrey Ye
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to write code in "???" in the following code:

//special location of database on filesystem
System.setProperty("???","D:/mysql-connector-java-3.0.17-ga");

//load database driver class
Class.forName(org.gjt.mm.mysql.Driver);

//establish connection to database
statement=connection.createStatement();

//query database
ResultSet resultset=statement.executeQuery("select*from author");

i can't find answer in sun

the database i want load is located in"D:\Program Files\MySQL\MySQL Server 5.0\data\test"
[ February 25, 2006: Message edited by: Bear Bibeault ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34210
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeffrey,
Where's the code to actually get a connection? That's usually where you specify the database.
 
Paul Clapham
Sheriff
Pie
Posts: 20980
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And with MySQL, you don't specify the location of the database. You specify the location of the MySQL server (machine and port) and the name of the database only.

All of this is covered in the documentation for the MySQL JDBC driver.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic