Option Explicit Const adStateOpen = &H00000001
Dim oConn Set oConn = CreateObject("ADODB.Connection") '--- Open a Connection using an ODBC DSN named "QT_UserDSN".To connect to remote db SET your DSN to remote db server oConn.ConnectionString "DSN=QT_UserDSN;UID=YourUserName;PWD=YourPassword;" oConn.ConnectionTimeout = 30 oConn.Open '--- Find out if the attempt to connect worked. If oConn.State = adStateOpen Then MsgBox "Welcome !" Else MsgBox "Sorry." End If On 9/25/08, Hokrani <[EMAIL PROTECTED]> wrote: > > u need connection string to connect to remote db. Follow the below to get > connection string for remote machine db. > > > > * Click on Insert > Checkpoint > Database Checkpoint in QTP > * Select check box against label 'Specify SQL Statment manually' > * Select check box against "Maximum number of rows" and enter 1 in text > filed > * Click on 'Next' button > * Click on 'Create..' button > * Click on 'New' button in 'Select Data Source' pop up window > * 'Select 'SQL Server' and click on 'Next' button in 'Create New > Data Source' pop up window > * click on 'Browse' button > * Enter the file name (say XXX) and store it in particular path and > click on 'Save' button in 'Save As' window (Say step A) > * click on 'Next' button in 'Create New Data Source' pop up widnow > * Click on 'Finish' button > * In 'Create a New Data Source to SQL server' pop up window, enter db > server name in 'Server' text box ( Example: qadb1) > * Click on 'Next' button > * select check box again lable 'With SQL Server authentication using > a login ID and password entered by the user' (Say step B) > * Enter login ID and Password for db server in text field > * Click on 'Next' button > * select check box again label 'Change the default database to' and > enter default database name > * click on 'Next' button > * Select check box against 'Save long running queries to the log > files' and enter '99999' in 'Long query time' text field > * Click on 'Finish' button > * In 'ODBC Microsoft SQL Server Setup' pop up window, click on 'Test > Data Source' button > > If u get 'TESTS COMPLETED SUCCESSFULLY!' message, then u > successfully conneted to db > * Click on 'OK' button 'SQL Server ODBC Data Source Test' pop up window. > * Click on 'ODBC Microsoft SQL Server Setup' pop up window > * In 'Select Data Source' pop up window, select XXX (from step A), > click on 'OK' button > * Enter loginID and Password (as entered in step B) and click on 'OK' > button > > Observed that some string in below 'Connection string' text box... use > this string to connect to DB. > > > -Hokrani > > On Thu, Sep 25, 2008 at 10:47 AM, sam <[EMAIL PROTECTED]> wrote: > >> >> HI All, >> >> Currently while connecting to a local database i.e. QTP and the >> database on same system , I am doing it by : >> >> Set objconn=createobject("ADODB.Connection") >> objconn.ConnectionString="DSN=MS Access Database;DBQ=C: >> \ClassicsAccess.MDB.mdb;DriverId=281;FIL=MS >> Access;MaxBufferSize=2048;PageTimeout=5;" >> objconn.Open >> >> >> But, if the database is on another system ..lets say 172.64.22.223, >> Then How am i goint to connect to that database ? Should it be like : >> Set objconn=createobject("ADODB.Connection", 172.64.22.223) >> objconn.ConnectionString="DSN=MS Access Database;DBQ=C: >> \ClassicsAccess.MDB.mdb;DriverId=281;FIL=MS >> Access;MaxBufferSize=2048;PageTimeout=5;" >> objconn.Open >> >> or there is some other way to connect. >> >> >> > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google "QTP - HP Quick Test Professional - Automated Software Testing" group. To post to this group, send email to MercuryQTP@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/MercuryQTP?hl=en -~----------~----~----~----~------~----~------~--~---