"General Error Unable to open the Temporary (volatile) ... registry key ..." from Access ODBC

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 get this error:

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

in particular

 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 the eclipse IDE Luna and the Java version is "1.7.0_45" (64 bit)

+6
source share
6 answers

Causes

Common error Unable to open the temporary (unstable) Ace DSN registry key for the process ...

This is the top-level error message generated by the Access Database Engine (aka "ACE") ODBC driver when the current process cannot open the Access database file for one of the following reasons:

  • Some other processes have opened the database "exclusively."

  • Some other processes initially opened the database file in Access as “shared” and has some pending structural modifications that require “exclusive” access to the file. Examples of pending changes are changes to the module code that have not yet been saved, or the presence of a form or report in the design view.

  • The account under which the current process is running does not have sufficient file system permissions to open the database file or the folder in which it is located.

  • The account under which the current process runs does not have sufficient permissions to access the values ​​under the key HKLM\SOFTWARE\ODBC .

  • The database file simply does not exist.

When only the top-level error message is reported, the earlier ODBC "Jet" driver issued somewhat more intuitive error messages. When another process executed "Open Exclusive" in the file, the error message was

Unable to use '(unknown)'; the file is already in use.

and when the file had pending design changes, an error message reported

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

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

Common error Unable to open the temporary (unstable) Ace DSN registry key for the process ...

This is because both drivers return several error messages, but they return them in a different order. Jet Messages ...

ERROR [HY000] [Microsoft] [ODBC Microsoft Access Driver] The database has been put into a state by an unknown user, which prevents it from being opened or locked.

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

ERROR Error [IM006] [Microsoft] [ODBC Driver Manager] SQLSetConnectAttr Error

ERROR [01000] [Microsoft] [ODBC Microsoft Access Driver] General warning Unable to open the 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 put into a state by an unknown user, which prevents it from being opened or locked.

... and ACE messages:

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

ERROR Error [IM006] [Microsoft] [ODBC Driver Manager] SQLSetConnectAttr Error

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

ERROR [HY000] [Microsoft] [ODBC Microsoft Access Driver] The database has been put into a state by an unknown user, which prevents it from being opened or locked.

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

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

ERROR [HY000] [Microsoft] [ODBC Microsoft Access Driver] The database has been put into a state by an unknown user, which prevents it from being opened or locked.

Decision

Scenarios 1 and 2 (another process has an “exclusive” file lock):

Make sure the database file is not opened by any other process. ndash often this simply means shutting down the Access application itself - and then retry the ODBC operation from the external application. Rebooting your machine is one way to ensure that any other such processes have been terminated and they have abandoned their requirements for the database file.

Scenario 3 (insufficient file / folder permissions):

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

Scenario 4 (insufficient permissions for the registry):

Adjust registry permissions to allow the account to access the HKLM\SOFTWARE\ODBC key. The most common reason in this case is because the IIS process runs under an account that does not have the usual "user" privileges. In this case, remember that you should not use Access databases with IIS anyway.

Scenario 5 (the database file does not exist):

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

+14
source

Reason 6 (otherwise not applicable) Forget changing the name of the file you are trying to open after you change the file name. those. try to open a nonexistent file.

+4
source

Reason 5 (not covered by Gord otherwise a great explanation)

User Error. For example, an attempt to use the ACE driver to read that it is not intended for processing (for example, an Excel file) that is read using the Jet ODBC driver in an earlier version of this function. Even if the message is vague, it correctly breaks the error in open time, and not after you think that the discovery was successful.: /

+1
source

In this case, you need to specify the entire path to your db access file. And in the url below, a space is required between two extensions (* .mdb, * .accdb)

eg:.

 String database="C:/Users/GIRI/Desktop/fdsfkdsfj/abc.accdb"; String url="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + database + ";DriverID=22;READONLY=true"; 
+1
source
  try { String conUrl = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + filepath; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection(conUrl); } catch(SQLException s) { System.out.println(s); } 

I think this link can help you http://java2carrer.blogspot.in/2013/06/insert-data-into-ms-access-from-excel.html

-1
source

Please try this code. I tried this on winning 7 trailing 64 bits with Office 2013 64bit.

 package dbase.dbconnection; import java.sql.*; public class MSAccessDbConnect { public static void main(String args[]) throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String password = ""; String dbName = "D:/maven_ejb_train/DATA/EmpTest.accdb"; String bd = dbName; // + ";PWD=" + password; String connURL = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + dbName; System.out.println("connURL ===== " + connURL); String sql2 = "select * from Employees "; Connection conn = DriverManager.getConnection(connURL, "", ""); System.out.println("aaa 111"); ResultSet rs = conn.createStatement().executeQuery(sql2); System.out.println("aaa 222"); while (rs.next()) { System.out.println("Name: " + rs.getString("EMP_NA") + " ID: " + rs.getString("EMP_NO")); } rs.close(); conn.close(); } } 
-1
source

Source: https://habr.com/ru/post/976378/


All Articles