Unable to connect to sybase through UFT 12.53 - hp-uft

I am trying to connect UFT with Sybase. But not able to progress.
Below is the error message i got upon trying diff connection strings:
[08001][Native Code: 30012][ASEOLEDB]Client unable to establish a connection
Connection Strings
1) objConnection.open "Driver={Adaptive Server Enterprise};Provider=ASEOLEDB;Data Source=ServerName/xxx.xxx.xxx.xxx:PortNumber,Catalog=db;User Id=UID;Password=pwd;" (Please note string works fine when Microsoft visual basic is used to make Sybase connection.
2) objConnection.open "Driver={Adaptive Server Enterprise}; Provider=ASEOLEDB;Server=sreverName/IpAdd; port=5000; db=db; uid=userid; pwd=password;"
Also i'm using DSN less connection. Ports used are - 5000, 5001, 2439, 2638, 4950

I had similar issues - No sure what worked for me will work for you but try any from my below efforts - the ones in bold worked for me
' objConnection.Open "Provider=iAnywhere Solutions 12 - Oracle;Server =qwe.us.net.intra:1523;User Id =abc;Password=t#P2h%mUxUh;Database = SCS"
' objConnection.Open "Provider=OraOLEDB.Oracle;SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=qwe.us.net.intra)(PORT=1523))(CONNECT_DATA=(SERVICE_NAME=REPORTSQ.us.net.intra)));uid=abc;pwd=t#P2h%mUxUh];"
' objConnection.Open "Driver={Microsoft ODBC Driver for Oracle};Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=REPORTINGQ.us.net.intra)(PORT=1523))(CONNECT_DATA=(SERVICE_NAME=REPORTSQ.us.net.intra)));uid=abc;pwd=t#P2h%mUxUh];"
' objConnection.Open "Driver={Microsoft ODBC Driver for Oracle};Data Source=REPORTINGD.us.net.intra:1523;uid=abc;pwd=t#P2h%mUxUh];"
' objConnection.Open "Provider=MSDAORA;Server =REPORTINGD.us.net.intra:1523;User Id =abc;Password=t#P2h%mUxUh];Database = SCS"
' objConnection.Open "Driver={Microsoft ODBC for Oracle};" & "Server=REPORTINGQ.us.net.intra;" & "Uid=abc;" & "Pwd=t#P2h%mUxUh]"
' objConnection.Open "Provider=OraOLEDB.Oracle.1;Persist Security Info=False;" & "User ID=abc;Password=t#P2h%mUxUh];Data Source=DWH_QA"
' objConnection.Open "Driver={Adaptive Server Enterprise};User ID=abc;Password=oc1b2008;Server=jdbc:sybase:Tds:scs.us.net.intra"
' objConnection.Open "Provider=Sybase.ASEOLEDBProvider.2;User ID=abc;Password=oc1b2008;Server Name=jdbc:sybase:Tds:scs.us.net.intra,50000; Initial Catalog=s1w"
' objConnection.Open "Provider=Sybase.ASEOLEDBProvider.2;User ID=abc;Password=oc1b2008;Data Source=jdbc:sybase:Tds:scs.us.net.intra,50000; Catalog=s1w"
' objConnection.Open "Provider=ASEOLEDB;User ID=abc;Password=oc1b2008;Data Source=jdbc:sybase:Tds:scs.us.net.intra,50000; Catalog=s1w"
' objConnection.Open "Provider=ASEOLEDB;User ID=abc;Password=oc1b2008;Server Name=jdbc:sybase:Tds:scs.us.net.intra,50000; Catalog=s1w"
' objConnection.Open "Driver={Sybase ASE ODBC Driver};User ID=abc;Password=oc1b2008;NetworkAddress=jdbc:sybase:Tds:scs.us.net.intra,50000; Db=s1w"
' objConnection.Open "Driver={Sybase ASE ODBC Driver};User ID=abc;Password=oc1b2008;NetworkAddress=jdbc:sybase:Tds:scs.us.net.intra:50000; Db=s1w"
' objConnection.Open "Driver={Sybase ASE ODBC Driver};User ID=abc;Password=oc1b2008;NA=scs,50000; Db=s1w"
' objConnection.Open "Driver={Sybase ASE ODBC Driver};User ID=abc;Password=oc1b2008;Srvr=jdbc:sybase:Tds:scs.us.net.intra:50000"
' objConnection.Open "Driver={Sybase ASE ODBC Driver};User ID=abc;Password=oc1b2008;Srvr=scs.us.net.intra:50000"
objConnection.Open "Driver={Adaptive Server Enterprise};User ID=abc;Password=oc1b2008;Server=scs.us.net.intra;port=50000;Db=s1w"
objConnection.Open "Driver={Sybase ASE ODBC Driver};User ID=abc;Password=oc1b2008;NA=scs.us.net.intra,50000; Db=s1w"

Related

VBScript_Get xml data stored in Oracle DB(DataType - CLOB)

This may seem to be a pretty basic issue but I am not able to find any solution for this. I have to admit that I have very little experience with databases. I looked at THIS question but it didn't help me much.
Issue:
Whenever I modify my query to fetch data of type CLOB from the database, I get the error "Unspecified Error". In the below code, I have written the query strQuery = "select CDATA from WR2_USR.router_xml_data where EVENT_ID= '987787454'". The column CDATA(of datatype CLOB) contains an Long XML which I need to fetch and store in a variable for further use. Is there any way to achieve that?
Code:
Option Explicit
Dim objCon, objRs, strCon, strQuery, i, strServer, strUid, strPwd
set objCon = CreateObject("adodb.connection")
set objRs = CreateObject("adodb.recordset")
strServer = "" 'Contains the correct Server information
strUid = "" 'Contains the user name
strPwd = "" 'Contains the password
strCon = "Driver={Microsoft ODBC for Oracle};SERVER="&strServer&";uid="&strUid&";pwd="&strPwd &";"
strQuery = "select CDATA from WR2_USR.router_xml_data where EVENT_ID= '987787454'"
objCon.open strCon
if objCon.state=1 then
objRs.open strQuery, objCon '<--- GETTING ERROR HERE
while (not objRs.eof)
msgbox objRs.fields.count
for i=0 to objRs.fields.count-1 step 1
msgbox cstr(objRs.fields.item(i).value)
next
objRs.movenext
Wend
end if
set objCon = Nothing
set objRs = Nothing
Error:
Column Details:
NOTE: If I change my query to fetch some other Column's data(not of CLOB datatype), the code runs fine.
ODBC Driver for Oracle from Microsoft is deprecated for ages:
Oracle 7.3x is supported fully; Oracle8 has limited support. The ODBC Driver for Oracle does not support any of the new Oracle8 data types — Unicode data types, BLOBs, CLOBs, and so on — nor does it support Oracle's new Relational Object Model.
Use the ODBC driver or OLE-DB Provider from Oracle, you can download from Oracle Data Access Components (ODAC) for Windows Downloads
Then the connection string has to look similar to this:
' ODBC Driver from Oracle
strCon = "Driver={Oracle in OraClient11g_home1};DBQ=" & strServer & ";Pwd=" & strPwd & ";Uid=" & strUid
' OLE DB Provider from Oracle
strCon = "Provider=OraOLEDB.Oracle;Data Source=" & strServer & ";Password=" & strPwd & ";User ID=" & strUid

VB6 application ado connection for TLS1.2

I have to support a VB6 application that is still in production (ugh). A customer is specifying our software needs to be PCI compliant which requires TLS 1.2.
Anyone know how to do this?
I am using SQL Server 2014. I'm patched to build 12.0.4502.0.
Public Function GetConnection() As ADODB.Connection
Dim con As ADODB.Connection
On Error Resume Next
Set con = New ADODB.Connection
con.ConnectionTimeout = 10
Dim connstring As String
'connstring = "Provider=SQLOLEDB;Server=" & gstrServer & ";Database=" & gstrDB & ";User Id=" & gstrUser & ";Password=" & gstrPwd
connstring = "Provider=MSDASQL;DRIVER=Sql Server;Server=" & gstrServer & ";Database=" & gstrDB & ";UID=" & gstrUser & ";PWD=" & gstrPwd
con.Open connstring
If Err Then Set con = Nothing
Set GetConnection = con
End Function
The project is referencing "Microsoft ADO Ext. 6.0 for DDL and Security" and "Microsoft ActiveX Data Objects 2.5 Library"
I have tried multiple connection string options.
Thanks!
I found the answer in Using ADO with SQL Server Native Client.
To enable the usage of SQL Server Native Client, ADO applications will
need to implement the following keywords in their connection strings:
Provider=SQLNCLI11
DataTypeCompatibility=80
The following is an example of establishing an ADO connection string that is fully enabled to work
with SQL Server Native Client, including the enabling of the MARS
feature:
Dim con As New ADODB.Connection
con.ConnectionString = "Provider=SQLNCLI11;" _
& "Server=(local);" _
& "Database=AdventureWorks;" _
& "Integrated Security=SSPI;" _
& "DataTypeCompatibility=80;" _
& "MARS Connection=True;"
con.Open
Changing the provider to SQLNCLI11 and adding DataTypeCompatibility=80 worked.

Vb conncetion string to Oracle DB

How will look connection string to Oracle db if I have such parameters:
HOST = host
PORT = 1531
SERVICE_NAME = service_name
User: USER_ADMIN
pass: USER_ADMIN
Now I have connection string like this:
set oConn = CreateObject("ADODB.Connection")
oConn.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=host/orcl;Persist Security Info=True;User ID=user;Password=password;Unicode=True;Driver={Microsoft ODBC for Oracle};"
oConn.Open
Correct me please!
Your connection string is wrong, you cannot use Provider=OraOLEDB.Oracle and Driver={Microsoft ODBC for Oracle} at the same time.
In case you like to use the Oracle OLE DB provider try this:
Set oConn = CreateObject("ADODB.Connection")
oConn.provider = "OraOLEDB.Oracle"
DB = host & ":" & port & "/" & SERVICE_NAME
oConn.Open "Data Source=DB", User, pass
which should be equivalent to:
Set oConn = CreateObject("ADODB.Connection")
DB = host & ":" & port & "/" & SERVICE_NAME
oConn.Open "Provider=OraOLEDB.Oracle;Data Source=DB;User Id=" & User & ";Password=" & pass
However, I do not know whether Oracle OLE DB supports Easy Connect Naming Method (EZ), I never used it. In case it does not support EZ try this one instead:
DB = "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=" & host & ")(PORT=" & port & "))(CONNECT_DATA=(SERVICE_NAME=" & SERVICE_NAME & ")))"
Actually such definition should be written in tnsnames.ora file, e.g.
DB_TNS.your.domain =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=host)(PORT=1531))
(CONNECT_DATA=
(SERVICE_NAME=service_name)
(SERVER=server)
(INSTANCE_NAME=instance_name)
)
)
Then you can simply use oConn.Open "Data Source=DB_TNS", User, pass
In case you prefer to use the ODBC driver (although the ODBC driver from Microsoft is deprecated) use this one: ADO ConnectionStings

QTP connection string for Sybase 16 database?

I can't seem to get my connection string correct.
Dim conn, rs
Set conn= createobject("adodb.connection")
set rs = createobject("adodb.recordset")
conn.Open "Provider=Sybase.ASEOLEDBProvider;Server Name = xxx.xxx.xxx.xxx,yyyy;User Id=user;Password=pwd;Database=mydatabase;"
rs.open "Select * from blah", conn
I keep getting an error stating, "Provider cannot be found. It may not be properly installed."
I know the provider is installed because I use the same computer for coding up C# applications that connect to Sybase 16 successfully all the time. Does anyone know the correct connection string for QTP/UFT?
I figured it out.
Dim conn, rs
Set conn= createobject("adodb.connection")
set rs = createobject("adodb.recordset")
conn.Open "Driver={Adaptive Server Enterprise}; Server=xxx.xxx.xxx.xxx; port=yyyy; uid=user; pwd=pwd; db=mydatabase;"
rs.open "Select * from blah", conn
Using this you'll be able to use QTP/UFT and connect to a sybase 16 database - so long as you have have the Sybase Adaptive Server Enterprise drivers installed on your system. It's a proprietary database and to my knowledge you'll have to either purchase drivers directly from Sybase or from a thrid party. If you're running Sybase 16 at your company you more than likely have the ASE drivers - ask around.
There is way to connect if it is in windows 7 Function
ConnectionTest()
DB_CONNECT_STRING = "Provider=OraOLEDB.Oracle; Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=" & myHostName & ")(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=" & myServiceNameOrSID & "))); User ID=" & myUsername & ";Password=" & myPassword & ";"
Set myConn = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
myConn.Open DB_CONNECT_STRING
objRecordSet.Open myQuery, myConn
Wscript.Echo objRecordSet.fields.item(1) & " " & objRecordSet.fields.item(2)
myConn.Close
End function
Call ConnectionTest()
if there is problem in mapping adodb driver need to invoke the exe file before running in windows 64 bit

ADO SQL Server, "Method 'Open' of object '_Connection' failed"

(Tearing my hair out, been doing this a million times for decades and now it doesn't work!) I have a simple VB6 program, connecting to SQL 2008 Express locally on the host machine. I can connect to the database using the same credentials in SQL Server Management Studio Express. However, when I run this code, I get the following error:
Run-time error '3706':
Method 'Open' of object '_Connection' failed
Dim DBConn As ADODB.Connection
Set DBConn = New ADODB.Connection
Dim ConnString As String
txtServer.Text = "R19DEV\SQLEXPRESS"
txtCatalog.Text = "MyDatabase"
txtUser.Text = "MyUser"
txtPassword.Text = "MyPassword"
ConnString = "Provider=SQLOLEDB.1;Persist Security Info=False;Initial Catalog=" & _
txtCatalog.Text & ";Data Source=" & txtServer.Text & ";User ID=" & txtUser.Text & _
";Password=" & txtPassword.Text
Debug.Print ConnString
DBConn.Open ConnString
Here's the connection string:
Provider=SQLOLEDB.1;Persist Security Info=False;Initial Catalog=MyDatabase;Data Source=R19DEV\SQLEXPRESS;User ID=MyUser;Password=MyPassword
OK, I'm not sure why this worked. I changed the connection provider from SQLOLEDB.1 to SQLOLEDB, and that fixed it.

Resources