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'm not sure if this is relevant information but since I only have a 32-bit driver for connecting to Sybase ODBC, and since this VBScript is running on a 64-bit machine, I am running it via commandline but using the SysWoW64 cmd.exe and running it like this:
C:\Windows\SysWOW64>cscript C:\My\Directory\MyVBScript.vbs
I am having trouble connecting to the Sybase database. I was originally having some issues with the connection string itself, but that seems to have been sorted out.
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
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
What am I missing here?
The parameter "Srvr" is not a valid connection parameter and the "Port" key-value pair is required.
Before
connStr = connStr &"Srvr="& ServerIP &","& Port &";"
After
connStr = connStr &"Server="& ServerIP & ";"
connStr = connStr &"Port="& Port &";"
Excerpt from Microsoft's website
Using Connection parameters chart
Following is a list of connection parameters other than from the DSN parameter that can be supplied to the ASE ODBC Driver
Excerpt from the User Guide for Adaptive Server Enterprise ODBC Driver by Sybase
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With