简体   繁体   中英

jdbc odbc connection using password with ms access

I am trying to make connection in jdbc with MS Access. The connection is being established successfully but it's not taking the password in the connection string. I am using the following code.

try 
 {
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  String connquery="jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};
  DBQ=d:/newfolder/db11.mdb";

  Connection c=DriverManager.getConnection(connquery,"","securityserver");
  Statement st=c.createStatement();
 }
 catch(Exception ex)

 {
 ex.printStackTrace();

 }

This connection is working properly without password but after applying the password it's throwing an exception.

You've been at this for days. Honestly, it's not that hard to connect to a relational database using Java.

I don't know what the deal is with Microsoft Access. I've used it before on small problems with minor success, but I wouldn't recommend it now that there are so many other alternatives available.

MySQL or PostgreSQL are probably beyond you, but I'd say you'll have better luck with the Derby database that's built into the JDK.

The JDBC-ODBC driver is a problem; it's not available if you're on a 64 bit OS. Access is for individual use; I wouldn't trust it for shared access. You're having problems with passwords; others won't be so reluctant to accept a password.

Change your database if you can and see if that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM