Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when connecting to Sybase from VBScript - internal Client Library error

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?

like image 474
Armin Avatar asked Apr 17 '15 20:04

Armin


1 Answers

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

enter image description here

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

enter image description hereenter image description hereenter image description hereenter image description hereenter image description here

like image 175
WorkSmarter Avatar answered Nov 03 '22 20:11

WorkSmarter