File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Connecting to Database in a jar file" Watch "Connecting to Database in a jar file" New topic

Connecting to Database in a jar file

prasad appecherla

Joined: May 06, 2002
Posts: 7

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? )


[edited to disable smilies]
[ December 01, 2004: Message edited by: Jeanne Boyarsky ]
I agree. Here's the link:
subject: Connecting to Database in a jar file
It's not a secret anymore!