Micro Focus QTP (UFT) Forums
Database connectivity error - 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Database connectivity error (/Thread-Database-connectivity-error)



Database connectivity error - galstar - 08-06-2010

Hi,

While doing connectivity to database i am facing an issue..Firstly the script containing connectivity funcn was working.But i transfared that on new system and created the same DSN..
Now while running the script error that "Timeout expire" is getting populated..

connectivity function:
Code:
Function Connect_to_db(Byval mfgprt)

Dim cnn,rss
Set cnn = CreateObject("ADODB.Connection")
Set rss = CreateObject("ADODB.recordset")
cnn.ConnectionString = "DSN=QTPDSN;Description=desc;UID=sa;PWD=Passw0rd;APP=QuickTest Professional;WSID=.....;DATABASE=.....;"
cnn.open
rss = cnn.Execute("select  UnitPrice  from ------where MfPartNumber ='" + mfgprt + "'")
Connect_to_db=rss(0)
End Function

Could anyone suggest me the reason behind this....?

Thanks


RE: Database connectivity error - basanth27 - 08-13-2010

galstar -
You need to debug line by line to get to the bottom of the issue. Well here are a few pointers,

1. Check if the connection is established.
2. Execute the query manually to see if you get the results. Execute with the exact query you are using.


RE: Database connectivity error - galstar - 08-19-2010

Yeah i got the reason...DB was not started..:-p
noe it is working fine...
Thanks for reply