Micro Focus QTP (UFT) Forums
error in db connection - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: error in db connection (/Thread-error-in-db-connection)



error in db connection - sarveshqtp - 07-11-2009

Code:
Dim con,rs
Set con=CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.RecordSet")
con.Provider="DSN=pp;Description=no;UID=sa;PWD=******;APP=QuickTest Professional;WSID=PPI"
con.Open "192.168.1.2" ' this is server name
rs.Open "select * from dummies",con



I m using above code to establish connection with sqlserver2005 but error is coming
as "Provider cannot be found. It may not be properly installed"
while connecting through db checkpoint its working fine.
I m using qtp9.2
Thanks in Advance


RE: error in db connection - KVK - 07-13-2009

Hi

Try this

Initial Catalog is the database that u want to use..


Code:
sConstr="Provider=sqloledb;Data Source=192.168.1.2;Initial Catalog=DBtest;User ID=sa;Password=******;"
Set Db_Connection = CreateObject("ADODB.Connection")
Db_Connection.open sConstr
Db_Connection.Execute "select * from dummies"



RE: error in db connection - sarveshqtp - 07-13-2009

Thanx It was perfect.