Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to set property of jdbc?  RSS feed

 
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
Sheriff
Posts: 36393
453
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
Posts: 22185
38
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!