ADODB Connection Fails on Windows 7 but Not XP - iis-7

I have a simple program to test opening a connection to excel file using ADODB.
This is ASP Classic using VBScript.
Here is the code:
<%# Language="VBScript" %>
<% Response.buffer = true %>
<html>
<body>
<%
'Name of the excel file
exceldb="AW_Test.xls"
excel_file_name=Server.MapPath(exceldb)
response.write(excel_file_name)
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "Driver={Microsoft Excel Driver (*.xls)}; DriverId=790; DBQ=" &excel_file_name & ";"
cn.Close
Set cn=Nothing
Response.Write("All is good in the world...")
%>
</body>
</html>
When trying to run on this configuration:
Windows 7 64bit
IIS 7
Application Pool in 32 bit mode
Files in root directory
Running on Local Host [http://localhost/adotest.asp]
I get the following results:
C:\inetpub\wwwroot\AW_Test.xls
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Excel Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data.
/adotest2.asp, line 13
However, on the same machine under this configuration:
Virtual PC in XP Mode
IIS 6
Files in root directory
Running on Local Host [http://localhost/adotest.asp]
I get the following results:
c:\inetpub\wwwroot\AW_Test.xls
All is good in the world...
Things I have verified/tried:
Verified permissions (note this is the root directory)
Tried using the Jet Engine instead with
cn.Open 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\WWWRoot\AW_Test.xls;Extended Properties="Excel 8.0;HDR=No"'
Got error:
C:\inetpub\wwwroot\AW_Test.xls
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/adotest3.asp, line 13
Verified ALL application pools running in 32 bit mode
Verified drivers exist in SYSWOW side of data sources
I am sure I am missing something simple but, I am about out of things to try.
I know there are much better ways than ASP Classic etc. but, this should still work...
I appreciate any help...

Try with just:
cn.Open "Driver={Microsoft Excel Driver (*.xls)}; DBQ=" &excel_file_name & ";"
It should work..

Related

SQLBase error HY092

I'm trying to config a connection with SQLBase with odbc driver on Windows and I never did that, but I'm getting the error:
Connection failed with SQL State: "HY092"
I'm using the Windows ODBC Administrator to try add the connection. In the field "Config Filename (INI)" of the configuration screen I put: "C:\Program Files (x86)\Centura\sql.ini" and I add "C:\Program Files (x86)\Centura\" to the PATH system variable.
In the application (.NET) I'm getting the message:
ERROR [HY092] [Gupta][ODBC Driver]Invalid attribute/option identifier
My sql.ini file has the content:
[win32client]
clientname=CWBXXX
[win32client.dll]
comdll=sqlws32
[win32client.
serverpath=server3,<SERVER_IP>,2155/<BASE_NAME>
Anyone could help me? Thank you.
Good to see you are using SQLBase . Awesome.
Two important settings to get right.
1) Make sure you are using the correct ODBC administrator
I'm guessing 32 bit in %systemdrive%\Windows\SysWoW64\odbcad32.exe.
If not , use the 64bit one in %systemdrive%\Windows\System32\odbcad32.exe.
Under System DSN tab Add the correct driver for the database. Either 'Centura SQLBase 3.6 32bit Driver' or the 'Gupta SQLBase 12.x' driver if you are running SQLBase 12.
Under the Configure Tab, specify the Data Source Name that you will use in your sql.ini. THEY MUST MATCH.
2)a. Make sure you only ever have 1 sql.ini on the client. Ever.
2)b. sql.ini needs the ODBC driver specified in the client section:
[win32client.dll]
comdll=sqlodb32
[odbcrtr]
odbctrace=off
longbuffer=32767
buffrow=10000
remotedbname=[dB Name specified in ODBC] ,
DSN=[Data Source Name specified in ODBC]
(without the square brackets eg. remotedbname=MyDatabase,DSN=MyDatasetName whatever names you have specified in ODBC admin.)

Connecting to MS Access Database from R (x64)

I am trying to access my Access database using R. I have tried the below options but I am not able to connect to the database. I am using 64 bit R and 64 bit Access. I am using windows 7 also.. :(
library(RODBC)
db <- "E:/testdb.accdb"
myconn <-odbcDriverConnect("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=E:/test.accdb")
con2 <- odbcConnect(db)
channel <- odbcConnectAccess("E:/testdb")
I always get the error. Please help me.
1: In odbcDriverConnect("DSN=E:/testdb.accdb") :
[RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
2: In odbcDriverConnect("DSN=E:/testdb.accdb") : ODBC connection failed
I think the problem is as error message suggests - you don't have x64 Microsoft Access driver installed. Check it in Control panel - ODBC Data Sources (x64) on the Drivers tab. If it's not there, try to install Microsoft Access Database Engine 2010 Redistributable.

ODBC Firebird Driver Unable to connect to data source;library'gds32.dll' failed to load

I want to build a connection between ODBC and Firebird. It has shown error messages like these:
[ODBC Firebird Driver] Unable to connect to data source; library'gds32.dll' failed to load
[ODBC Firebird Driver] Invalid connection string attribute.
Here is my code:
Dim conn As ADODB.connection
Dim vError As Variant
Dim sErrors As String
Dim stringsql As Long
Dim dbs As DAO.Database
Dim recordset_case As ADODB.Recordset
'*************************************************************
'Setting up connection between IRIS data and central database
'***********************************************************
'1.set up connection
Set conn = New ADODB.connection
On Error Resume Next
conn.Open "DRIVER=Firebird/InterBase(r) driver;
DBNAME=C:\IRIS\Data\IRIS_TEST.IB; UID=SYSDBA; PWD=masterkey;READONLY = YES"
On Error GoTo 0
'to test whether the connection has been built over the IRIS and central database
If conn.State = adStateOpen Then
'adstateopen=the object is open
MsgBox "Connection Succeeded", vbInformation
Else
For Each vError In conn.Errors
sErrors = sErrors & vError.Description & vbNewLine
Next vError
If sErrors > "" Then
MsgBox sErrors, vbExclamation
Else
MsgBox "Connection Failed", vbExclamation
End If
End If
At this stage, I have tried these following steps:
Based on this article, I have renamed the fdclient.dll to gds32.dll and copied to system32 file. Then I selected Firebird client library in the Firebird ODBC driver setting.
This does not work.
Uninstall and reinstall Firebird. Due to Firebird being a part of our software package, we did follow that step. Beside, we have checked the Firebird is the latest version for 2.5.4. Thus, we do have the latest version for Firebird server.
That does not work either.
On windows 64 bit the 32 bit dll files are in SysWoW64, not system32 (that, logically..., contains the 64 bit dlls).
If you want to install the 32 bit gds32.dll, I'd strongly advise to use the instclient.exe included in the Firebird install instead of renaming fbclient.dll. For a 64 bit Firebird the one in bin\ is for 64 bit, the 32 bit is in wow64 or wow (I believe, I don't have a Windows install at hand).
To run instclient.exe, start a command prompt as administrator.
To install fbclient.dll use:
instclient i f
To install gds32.dll use:
instclient i g
Make sure you pick the right instclient (from bin for 64 bit or from wow or wow64 for 32 bit); or just install both. Also make sure you have installed the 32 bit ODBC driver for Firebird.
Regarding your last comment: I am at loss to explain this; maybe it uses a different config or driver?

SQLite3 on ODBC Driver: string connection error

I'm trying to connect to SQLite through ODBC/Windows 7 with VbScript.
Using Werner's SQLite ODBC driver (http://www.ch-werner.de/sqliteodbc) to connect to a local SQLite file (c:\test.db).
Using the connection string suggest at https://www.connectionstrings.com/sqlite3-odbc-driver
Dim dbConn : Set dbConn = CreateObject("ADODB.Connection")
ConnectionString = "DRIVER=SQLite3 ODBC Driver;Database=c:\test.db;LongNames=0;Timeout=1000;NoTXN=0; SyncPragma=NORMAL;StepAPI=0;"
dbConn.open ConnectionString
I already tried reinstalling the driver and restarting the system. The error message is always there:
Error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Code: 80004005
Source: Microsoft OLE DB Provider for ODBC Drivers
Any ideas?
Quoted from the SQLite ODBC Driver developer (Christian):
Check your installation. Version 0.992 is pretty old, current version
is 0.999. If you have a 64 bit Windows, install both 64 and 32 bit
drivers. It could be that the VB stuff is still 32 bit.
The program launching the script was 32Bit (despite the OS is 64Bit). Hence the need to install both 32 and 64Bit versions of the driver.

MySQL connection string for ASP.NET

I have a ASP.NET application running in VS2008 and i have ODBC connection in web.config file.
I am using 64bit Windows 7 machine.
I am trying to connect it with my MYSQL workbench but it shows me the following error:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not
found and no default driver specified
and i am using the following connection string :
add name="dbConnectionString" connectionString="DRIVER={MySQL ODBC 5.2w Driver};server=localhost;User Id=root;database=dbname; providerName="System.Data.Odbc"
Please let me know what i am missing ?
Thanks in advance
You need to install MyODBC which is MyODBC 5.2 in your case.. Or you can use whatever MYODBC Driver is installed.. just change your DRIVER in the connection string accordingly

Resources