简体   繁体   English

jdbc odbc连接,使用具有ms访问权限的密码

[英]jdbc odbc connection using password with ms access

I am trying to make connection in jdbc with MS Access. 我正在尝试使用MS Access在jdbc中建立连接。 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. 老实说,使用Java连接到关系数据库并不难。

I don't know what the deal is with Microsoft Access. 我不知道与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. MySQL或PostgreSQL可能超出您的范围,但我想说,使用JDK中内置的Derby数据库会更好。

The JDBC-ODBC driver is a problem; JDBC-ODBC驱动程序有问题。 it's not available if you're on a 64 bit OS. 如果您使用的是64位操作系统,则该功能不可用。 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. 如果可以,请更改数据库,然后查看是否有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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