This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • 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
Marshal
Posts: 37180
515
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: 22374
42
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
Boost this thread!