Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Password Protected .MDB File

14 views
Skip to first unread message

GjoreNET

unread,
Dec 3, 2009, 4:34:24 AM12/3/09
to
Hi, I'm having a problem with reading a password protected .mdb.
Here is the code that I use (Note: it is working just fine on a file
that is not with password):

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String filename = "d:/ARCHIVE_NOV_2009.mdb";
String database = "jdbc:odbc:Driver={Microsoft Access
Driver (*.mdb)};DBQ=";
database+= filename.trim() +
";DriverID=22;READONLY=true}";
Connection con = DriverManager.getConnection
( database ,"Admin","a1b2c3");
Statement s = con.createStatement();

It returns the error:
ERROR: java.sql.SQLException: [Microsoft][ODBC Microsoft Access
Driver] Not a valid password.

I have checked my MDB file it says:
Current User: Admin
and Password: a1b2c3

F1, F1, F1.....

Arne Vajhøj

unread,
Dec 3, 2009, 8:24:52 PM12/3/09
to

The JDBC ODBC bridge really sucks.

Try:

String database = "jdbc:odbc:Driver={Microsoft Access Driver

(*.mdb)};DBQ=" + filename.trim() +
";DriverID=22;READONLY=true;Uid=Admin;Pwd=a1b2c3;}";
Connection con = DriverManager.getConnection(database);

Arne

GjoreNET

unread,
Dec 7, 2009, 3:23:01 AM12/7/09
to
I tried that code it doesn't work.
Thanks anyway

Arne Vajhøj

unread,
Dec 8, 2009, 8:18:41 PM12/8/09
to
GjoreNET wrote:
> I tried that code it doesn't work.

Does that connection string work for another type of
ODBC access (non-Java) ?

Arne

Message has been deleted

GjoreNET

unread,
Dec 10, 2009, 3:35:23 AM12/10/09
to
This is the correct code. It works perfectly on "PASSWORD" and/or
"PASSWORD LESS" file

Class.forName
("sun.jdbc.odbc.JdbcOdbcDriver");
// set this to a MS Access DB you have on your
machine


String filename = "d:/ARCHIVE_NOV_2009.mdb";

Connection Database =
DriverManager.getConnection("jdbc:odbc:Driver=
{MicroSoft Access Driver (*.mdb)};DBQ="+filename+"","Admin","a1b2c3");

0 new messages