“一般错误无法打开注册表项临时(易失性)..."从访问 ODBC [英] "General error Unable to open registry key Temporary (volatile) ..." from Access ODBC

查看:28
本文介绍了“一般错误无法打开注册表项临时(易失性)..."从访问 ODBC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了以下方法:

private String password = "";private String dbName = "dataHC.accdb";私人字符串 bd = dbName + ";PWD=" + 密码;String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="+bd+";";私人连接 conn = null;//连接公共无效连接(){尝试{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");conn = DriverManager.getConnection(url);如果(连接!= null)System.out.println("Conexión a base de datos "+dbName+".listo");}catch(SQLException e){System.out.println(e);}catch(ClassNotFoundException e){System.out.println(e);}}

字体:http://www.jc-mouse.net/base-de-datos/consultas-con-parametros-en-access-y-java

我得到这个错误:

<块引用>

[Microsoft][ODBC Microsoft Access Driver]一般错误无法打开进程 0x7f8 线程 0x1174 DBC 的注册表项临时(易失性)Ace DSN

特别

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]一般错误无法打开进程 0x7f8 线程 0x1174 DBC 的注册表项临时(易失性)Ace DSN0x8dc8d78 喷气机'.线程main"中的异常 java.lang.NullPointerException在 depuracionDB.consultap(depuracionDB.java:67)在 depuracionDB.main(depuracionDB.java:103)

我使用的是 Eclipse IDE Luna 和 Java 版本1.7.0_45"(64 位)

解决方案

原因

<块引用>

一般错误无法为进程打开注册表项临时(易失性)Ace DSN ...

这是当当前进程由于以下原因之一而无法打开 Access 数据库文件时,由 Access 数据库引擎(又名ACE")ODBC 驱动程序产生的顶级错误消息:

  1. 某些其他进程独占"打开了数据库.

  2. 其他一些进程最初在 Access 中将数据库文件打开为共享"并且有一些未决的结构修改,需要对文件进行独占"访问.此类未决修改的示例包括对尚未保存的模块代码的编辑,或者在设计视图中打开表单或报表.

  3. 当前进程所使用的帐户没有足够的文件系统权限来打开数据库文件或其所在的文件夹.

  4. 运行当前进程的帐户没有足够的注册表权限来访问 HKLMSOFTWAREODBC 键下的值.

  5. 数据库文件根本不存在.

  6. 您尝试打开的数据库需要更新版本的 Microsoft Access.

当仅报告顶级错误消息时,较早的Jet"ODBC 驱动程序会生成更直观的错误消息.当另一个进程对文件执行打开独占"时,错误消息是

<块引用>

无法使用(未知)";文件已被使用.

当文件有待处理的设计更改时,错误消息说

<块引用>

数据库已被未知用户置于某种状态,以防止其被打开或锁定.

然而,当我们只看到由 ACE ODBC 驱动程序产生的顶级消息时,我们看到的是

<块引用>

一般错误无法为进程打开注册表项临时(易失性)Ace DSN ...

这是因为两个驱动程序都返回多个错误消息,但它们以不同的顺序返回它们.Jet 消息是...

<块引用>

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] 数据库已被未知用户置于阻止打开或锁定的状态.

错误 [01000] [Microsoft][ODBC Microsoft Access Driver]常规警告无法打开注册表项临时(易失性)Jet DSN for process 0xed4 Thread 0x1204 DBC 0xab004 Jet".

ERROR [IM006] [Microsoft][ODBC Driver Manager] 驱动程序的 SQLSetConnectAttr 失败

错误 [01000] [Microsoft][ODBC Microsoft Access Driver]常规警告无法打开注册表项临时(易失性)Jet DSN for process 0xed4 Thread 0x1204 DBC 0xab004 Jet".

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] 数据库已被未知用户置于阻止打开或锁定的状态.

... 而 ACE 消息是:

<块引用>

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]一般错误无法打开进程 0xf6c Thread 0x1568 DBC 0x6347fec Jet' 的注册表项临时(易失性)Ace DSN.

ERROR [IM006] [Microsoft][ODBC Driver Manager] 驱动程序的 SQLSetConnectAttr 失败

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]一般错误无法打开进程 0xf6c Thread 0x1568 DBC 0x6347fec Jet' 的注册表项临时(易失性)Ace DSN.

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] 数据库已被未知用户置于阻止打开或锁定的状态.

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]一般错误无法打开进程 0xf6c Thread 0x1568 DBC 0x6347fec Jet' 的注册表项临时(易失性)Ace DSN.

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]一般错误无法打开进程 0xf6c Thread 0x1568 DBC 0x6347fec Jet' 的注册表项临时(易失性)Ace DSN.

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] 数据库已被未知用户置于阻止打开或锁定的状态.

解决方案

场景 1 和 2(另一个进程对文件有独占"锁):

确保数据库文件没有被任何其他进程打开–通常这意味着只需关闭 Access 应用程序本身——然后从外部应用程序重新尝试 ODBC 操作.重新启动计算机是确保任何其他此类进程已终止并放弃对数据库文件的声明的一种方法.

场景 3(文件/文件夹权限不足):

调整权限或将文件移动到用户可以打开文件的位置.将数据库文件放在驱动器的根文件夹中是导致此类问题的常见原因.

场景 4(注册表权限不足):

调整注册表权限,允许账户访问HKLMSOFTWAREODBC键.在这种情况下,最常见的原因是 IIS 进程在没有正常用户"权限的帐户下运行.在这种情况下,请记住无论如何都不应该在 IIS 中使用 Access 数据库.

场景5(数据库文件不存在):

修复连接字符串,使其包含现有文件的有效路径.

场景 6(数据库文件需要更新版本的 Access):

升级 Microsoft Access 或 Access Database Engine Redistributable(如果可用).

I tried the following:

private String password = "";
private String dbName = "dataHC.accdb";
private String bd = dbName + ";PWD=" + password;
String  url   = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="+bd+";";

private Connection conn = null;

//Connect
public void connect() {
    try{
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        conn = DriverManager.getConnection(url);
        if (conn != null)
            System.out.println("Conexión a base de datos "+dbName+". listo");
    }catch(SQLException e){
        System.out.println(e);
    }catch(ClassNotFoundException e){
        System.out.println(e);
    }
}

Font: http://www.jc-mouse.net/base-de-datos/consultas-con-parametros-en-access-y-java

And I obtain this error:

[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0x7f8 Thread 0x1174 DBC

specifically

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0x7f8 Thread 0x1174 DBC 0x8dc8d78                                                              Jet'.
Exception in thread "main" java.lang.NullPointerException
    at depuracionDB.consultap(depuracionDB.java:67)
    at depuracionDB.main(depuracionDB.java:103)

I am using eclipse IDE Luna and Java version "1.7.0_45" (64 bits)

解决方案

Causes

General error Unable to open registry key Temporary (volatile) Ace DSN for process ...

This is the top-level error message produced by the Access Database Engine (a.k.a. "ACE") ODBC driver when the current process is unable to open the Access database file for one of the following reasons:

  1. Some other process has opened the database "exclusively".

  2. Some other process originally opened the database file in Access as "shared" and has some pending structural modification that requires "exclusive" access to the file. Examples of such pending modifications are edits to Module code that have not yet been saved, or having a Form or Report open in Design View.

  3. The account under which the current process is running does not have sufficient filesystem permissions to open the database file or the folder in which it resides.

  4. The account under which the current process is running does not have sufficient registry permissions to access the values under the HKLMSOFTWAREODBC key.

  5. The database file simply does not exist.

  6. The database you are trying to open requires a newer version of Microsoft Access.

When only the top-level error message is reported, the earlier "Jet" ODBC driver produced somewhat more intuitive error messages. When the other process had done an "Open Exclusive" on the file the error message was

Could not use '(unknown)'; file already in use.

and when the file had pending design changes the error message said

The database has been placed in a state by an unknown user that prevents it from being opened or locked.

However, when we only see the top-level message produced by the ACE ODBC driver all we see is

General error Unable to open registry key Temporary (volatile) Ace DSN for process ...

That is because both drivers return multiple error messages, but they return them in a different order. The Jet messages are ...

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] The database has been placed in a state by an unknown user that prevents it from being opened or locked.

ERROR [01000] [Microsoft][ODBC Microsoft Access Driver]General Warning Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xed4 Thread 0x1204 DBC 0xab004 Jet'.

ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed

ERROR [01000] [Microsoft][ODBC Microsoft Access Driver]General Warning Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xed4 Thread 0x1204 DBC 0xab004 Jet'.

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] The database has been placed in a state by an unknown user that prevents it from being opened or locked.

... while the ACE messages are:

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0xf6c Thread 0x1568 DBC 0x6347fec Jet'.

ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0xf6c Thread 0x1568 DBC 0x6347fec Jet'.

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] The database has been placed in a state by an unknown user that prevents it from being opened or locked.

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0xf6c Thread 0x1568 DBC 0x6347fec Jet'.

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0xf6c Thread 0x1568 DBC 0x6347fec Jet'.

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] The database has been placed in a state by an unknown user that prevents it from being opened or locked.

Solutions

Scenarios 1 and 2 (another process has an "exclusive" lock on the file):

Ensure that the database file is not opened by any other process – often that means just closing the Access application itself – and then re-try the ODBC operation from your external application. Rebooting your machine is one way to ensure that any other such processes have been terminated and have relinquished their claim to the database file.

Scenario 3 (insufficient file/folder permissions):

Either adjust the permissions or move the file to a location where the user can open the file. Placing the database file in the root folder of a drive is a common cause of this type of problem.

Scenario 4 (insufficient registry permissions):

Adjust the registry permissions to allow the account to access the HKLMSOFTWAREODBC key. The most common cause in this case is that an IIS process is running under an account that does not have normal "user" privileges. In that case remember that you should not be using Access databases with IIS anyway.

Scenario 5 (database file does not exist):

Fix the connection string so that it contains a valid path to an existing file.

Scenario 6 (database file requires a newer version of Access):

Upgrade Microsoft Access or the Access Database Engine Redistributable (if available).

这篇关于“一般错误无法打开注册表项临时(易失性)..."从访问 ODBC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆