I am writing a VBScript that connects to a Sybase database, reads some data from a table and stores it in variables, then connects to a MS SQL server and inserts data into tables with the variable data that was stored earlier.
I have found a couple of existing scripts to get me going here and here.
I understand these just fine. The only problem is the Database connection string itself. Here is the connection string that is currently being used. (I have used correct values in the actual script but changed some here for security purposes)
Provider=Sybase.ASEOLEDBProvider.2;Driver={SYBSE ASE ODBC Driver};Data Source=MyDataSource;Port=1234;Database=MyDatabase;uid=MyUser;pwd=MyPassword
But it is causing the error: Provider cannot be found. It may not be properly installed.
Here's some system info that you may need to determine the cause of the issue:
- Script will be run on 64-bit Windows 7 machine
- I have successfully connected to this Sybase database using MS Access
- I have installed the Sybase ASE ODBC Driver (32-bit) version 03.50.0010
- I have confirmed that it is installed and working by going to C:\Windows\SysWOW64\odbcad32.exe and located the drivers there
- The database is a System DSN (not a User DSN)
- Sybase Open Client version 10.0.4
The issue seems to be with the Provider=
part of the connection string. It's worth noting here that as soon as I take away the Provider=
part, I get this error: The specified DSN contains an architecture mismatch between the Driver and Application. So this leads me to believe that there is a 32-bit and 64-bit mismatch here. I've researched this and it turns out the way to fix it is to add a Provider=
to your connection string to somehow specify which one to use. Here is a list of the Providers I've tried in the connection string:
- Sybase ASE OLE DB Provider
- Sybase.ASEOLEDBProvider
- ASEOLEDB
- ASEOLEDB.1
- Sybase.ASEOLEDBProvider.2
- Sybase
- Advantage OLE DB Provider
All of these throw the same error. What am I missing here?
EDIT: As per your suggestions I have made some revisions to the script and have been able to push past the initial error, but now I get a completely different error. Here's the script as it is now
Dim connStr, objConn
DataSource = "ICCM_PREVIEW"
ServerIP = "1.2.3.4"
Port = "1234"
DBuser = "myUser"
DBpwd = "myPassword"
DBName = "myDatabase"
Driver = "SYBASE ASE ODBC Driver"
connStr = ""
connStr = connStr &"Driver="& Driver &";"
connStr = connStr &"Data Source="& DataSource &";"
connStr = connStr &"Srvr="& ServerIP &","& Port &";"
connStr = connStr &"Database="& DBName &";"
connStr = connStr &"uid="& DBuser &";"
connStr = connStr &"pwd="& DBpwd &";"
Wscript.Echo connStr
'Define object type
Set objConn = CreateObject("ADODB.Connection")
'Open Connection
objConn.open connStr
Here is the error message I get now, but I have no idea how to get past this one:
Microsoft OLE DB Provider for ODBC Drivers: [SYBASE][ODBC Sybase driver][Sybase]ct_connect(): user api layer: internal Client Library error: HAFAILOVER:Trying to connect to server