views:

169

answers:

2

This is the connection string that is currently working on a non-password protected MS Access database.

this code snippet is from our properity file:

db.url = jdbc:odbc:Driver\={Microsoft Access Driver (*.mdb)};Dbq\=C:\Inventory.mdb;DriverID\=22;READONLY\=true

How do I add a password to this connection string for a MS Access DB protected by a database password (Non-ULS)?

Thanks!

+2  A: 

Referenced from here: Java Support

db.url = jdbc:odbc:Driver\={Microsoft Access Driver (*.mdb)}Dbq\=C:\Inventory.mdb;DriverID\=22;READONLY\=true; UID\=me;PWD\=secret
Tommy
+1, but yuck, that's one ugly URL...
skaffman
This is what happens when you have to play with access... :-(
WillPhil
I edited my question to make it more specific. The solution above only works for ULS passwords. Any thoughts on what do to in the case of a plain db password? Thanks!
WillPhil
A: 

I know you're asking for ODBC, but is it impossible to use OLEDB, as in the connect string provided on ConnectionStrings.com:

  Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDB:Database Password=MyDbPassword;

I don't know that the Jet ODBC driver provides any support for database passwords, which were not introduced until Jet 4 (and are completely worthless in any version of Access/Jet/ACE).

David-W-Fenton