Can't connect twice to linked table using ACE/JET driver

Posted by Tmdean on Stack Overflow See other posts from Stack Overflow or by Tmdean
Published on 2010-04-15T22:26:26Z Indexed on 2010/04/15 22:33 UTC
Read the original article Hit count: 384

Filed under:
|
|
|

I'm trying to connect to an MS Access database linked table in VBScript. It works fine connecting the first time on one connection but if I close that connection and open a new one in the same script it gives me an error.

test.vbs(13, 1) Microsoft Office Access Database Engine: 
ODBC--connection to '{Oracle in OraClient10g_home1}DB_NAME' failed.

This is some code that triggers the error. TABLE_1 is an ODBC linked table in the test.mdb file.

Dim cnn, rs

Set cnn = CreateObject("ADODB.Connection")
cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data source=test.mdb"

Set rs = cnn.Execute("SELECT * FROM [TABLE_1]")
rs.Close
cnn.Close

Set cnn = CreateObject("ADODB.Connection")
cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data source=test.mdb"

Set rs = cnn.Execute("SELECT * FROM [TABLE_1]") '' crashes here
rs.Close
cnn.Close

This error does not occur if I try to access an ordinary Access table. Right now I'm thinking it's a bug in the Oracle ODBC driver.

© Stack Overflow or respective owner

Related posts about ms-access

Related posts about ado