Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DB2 Database testing
#1
Solved: 11 Years, 4 Months, 2 Weeks ago
Can anybody tell how to test
1) DB2 database at background.
2) Other databases at background.
3) How to connect to SQL database.
Reply
#2
Solved: 11 Years, 4 Months, 2 Weeks ago
try http://www.connectionstrings.com/
Reply
#3
Solved: 11 Years, 4 Months, 2 Weeks ago
Hey Jackomcnabb, that's pretty useful site. Thanks.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#4
Solved: 11 Years, 4 Months, 2 Weeks ago
Below function will help to connect oracle data base.for SQL data base we have to provide required provider name.correct me if am wrong.


Public function openDatabase( byval userID, byval passwd, byval dataBase, byval sql, byref conn,byref rs)

Code:
set conn=createobject("adodb. connection")
        set rs=createobject("adodb.recordset")
        conn.open= "Provider=OraOLEDB.Oracle.1;Password=" & passwd & ";Persist Security Info=True;User ID=" &_
                                                        userID & ";Data Source=" & dataBase & ";"
    rs.open sql,conn
    
End Function
Reply
#5
Solved: 11 Years, 4 Months, 2 Weeks ago
Hi Every one
I am new to Qtp. I can not connect mysql database with qtp since there is no drivers for mysql in QTP.Please telll me how to connect with database since I am working in mysql only.
mysql version is 5.0
Thanks
swati
Reply
#6
Solved: 11 Years, 4 Months, 2 Weeks ago
Install MySQL ODBC driver in your computer first.
And then use connection string.
Example:

Code:
' To Connect to MySQL Database
' Before using this function, make sure MySQL ODBC 5.1 Driver is installed
    Public Function MySQLConnect(Login)
                  Dim Connection, Recordset, SQL, ConnectionString, SQL1, SQL2
                SQL1 = "UPDATE wuser SET password = 'password' where login = '"
                SQL2 = "';"
                SQL = SQL1 + Login + SQL2
                        Set Connection = CreateObject( "ADODB.Connection")
                        Set Recordset = CreateObject( "ADODB.Recordset")
                        'Connection.Open "DSN=mysql"
                        ConnectionString="DRIVER= {MySQL ODBC 5.1 Driver}; SERVER= Server Name; PORT=3306;DATABASE=Database Name; USER=user id; PASSWORD=password; OPTION=3;"
                        Connection.Open ConnectionString
                        Recordset.Open SQL,Connection
                        'If Recordset.EOF Then
                        ' msgbox "No records returned."
                        'Else
                                    'Do While NOT Recordset.Eof
                                    'msgbox Recordset("ID")
                                    'msgbox Recordset("LOGIN")
                                    'msgbox Recordset("PASSWORD")
                                    'Recordset.MoveNext
                         'End If
                         'Recordset.Close
                         Set Recordset=nothing
                         Connection.Close
                         Set Connection=nothing
    End Function
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP for Cobol DB2 tjahe 1 2,826 04-07-2011, 01:43 PM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)