QTP Forum


Join the forum, it's quick and easy

QTP Forum
QTP Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
 
 

Display results as :
 


Rechercher Advanced Search

Poll
Keywords

Latest topics
» composite primary key
How to connect to Database using QTP or vbscripting EmptyThu Jun 19, 2014 11:31 am by thomasdfg

» How to identify the object when it is dynamically changing behavior
How to connect to Database using QTP or vbscripting EmptyWed Jun 18, 2014 6:37 pm by thomasdfg

» Patches for QTP 10, 11, 11.5
How to connect to Database using QTP or vbscripting EmptyWed Jun 18, 2014 6:04 pm by thomasdfg

» Retrieving data from Txt file into datatable
How to connect to Database using QTP or vbscripting EmptyWed Jun 18, 2014 5:32 pm by thomasdfg

» VB Script to count number of links in a web page.
How to connect to Database using QTP or vbscripting EmptyWed Jun 18, 2014 4:51 pm by thomasdfg

» Customized HTML reports in QTP
How to connect to Database using QTP or vbscripting EmptyWed Jun 18, 2014 4:42 pm by thomasdfg

» how to print values into a field of a web page, from a data table in qtp?
How to connect to Database using QTP or vbscripting EmptyWed Jun 18, 2014 4:37 pm by thomasdfg

» How to delete cookies using QTP?
How to connect to Database using QTP or vbscripting EmptyWed Jun 18, 2014 4:30 pm by thomasdfg

» When UFT Does Not Identify an Object
How to connect to Database using QTP or vbscripting EmptyWed Jun 18, 2014 4:23 pm by thomasdfg

May 2024
MonTueWedThuFriSatSun
  12345
6789101112
13141516171819
20212223242526
2728293031  

Calendar Calendar

Affiliates
free forum

Similar topics

    How to connect to Database using QTP or vbscripting

    Go down

    How to connect to Database using QTP or vbscripting Empty How to connect to Database using QTP or vbscripting

    Post by Gajre Mon Jun 18, 2012 1:35 am

    The following sample code (or some form of it) is readily available in most of the QTP or VBScript help forums, so don’t despair if I’m not giving you exactly what you need.


    Dim objConn ' As an ADODB Connection object

    Dim objRecSet ' As an ADODB Recordset object

    Dim strConn ' As a connection string

    Dim strQuery ' As a SQL query

    ' Create the connection and recordset objects

    Set objConn = CreateObject("ADODB.Connection")

    Set objRecSet = CreateObject("ADODB.Recordset")

    ' Create the connection string

    strConn = "DRIVER={Oracle in instantclient10_2};DBQ=<YourTNSName>;UID=<YourUsername>;PWD=<YourPassword>"

    ' Define the SQL query

    strQuery = "SELECT * FROM <YourDatabaseTable>"

    ' Open the connection

    objConn.Open strConn

    ' Retrieve data using SQL query

    objRecSet.Open strQuery, objConn

    ' Do something with the data here

    ' Close the connection (also closes the recordset and destroys both)

    objConn.Close


    Sample TNSNAMES.ORA Content:

    YourTNSName =

    (DESCRIPTION =

    (ADDRESS_LIST =

    (ADDRESS = (PROTOCOL = TCP)(HOST = <YourServerNameOrIP>)(PORT = <YourPortOrDefault1521>))

    )

    (CONNECT_DATA =

    (SID = <YourDBSID>)

    (SERVER = DEDICATED)

    )

    )
    Gajre
    Gajre
    Admin

    Posts : 37
    Join date : 2012-06-17
    Age : 41
    Location : Hyderabad

    https://qtpelearning.forumotion.com

    Back to top Go down

    Back to top

    - Similar topics

     
    Permissions in this forum:
    You cannot reply to topics in this forum