wood burning stoves*
The moose likes JDBC and the fly likes Connecting to Database in a jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connecting to Database in a jar file" Watch "Connecting to Database in a jar file" New topic
Author

Connecting to Database in a jar file

prasad appecherla
Greenhorn

Joined: May 06, 2002
Posts: 7
Hi,

I want to access a Database ( access.mdb ) in a jar file(test.jar )and tried to achieve that using following code.

...
String filename = "jdbcdbc:jar C:/test.jar)access";
String database = "jdbcdbcriver={Microsoft Access Driver *.mdb)};DBQ=";
database += filename.trim() + ";DriverID=22;READONLY=true}";

//get the connection from the DriverManager
con = DriverManager.getConnection( database);
...

Can anybody pls. tell me where I am making mistake? ( any syntax problem in using jar subprotocol? )

Thanks,
Prasad.

[edited to disable smilies]
[ December 01, 2004: Message edited by: Jeanne Boyarsky ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Connecting to Database in a jar file