Forum Discussion

Wamboo's avatar
Wamboo
Community Hero
6 years ago

Connect TestComplete to Oracle database using Progress Datadirect Driver

Hi,

I did not find any instruction for this one so im sharing my solution with you guys.

 

To properly configure the Oracle Database Connection:

 

1) Install the driver available in (b)
2) Perform 'Data Source' configuration available in point c).
3) Learn how to handle ADO class in TestComplete

 

Example of a valid JS to connect TC to Oracle:
I)

var connectstring = "Data Source=Oracle Wire Protocol;User ID=user;Password=pass";

var query = ADO.CreateADOQuery();
query.ConnectionString = connectstring;
query.SQL = "select * from MRP_PERFORMANCE;";
query.Open();
query.First();

var res = query.FieldByName("Field").Value;

II)

var connectstring = "Data Source=Oracle Wire Protocol;User ID=user;Password=pass";

var query = ADO.CreateADOQuery();
query.ConnectionString = connectstring;
query.SQL =
`
SELECT mrp.firm_mrp(1) AAAAA FROM firm
`;
query.Open();
query.First();

var res = query.FieldByName("AAAA").Value;

Helpful links:

(a) Doc SmartBear:
https://community.smartbear.com/t5/TestComplete-Functional-Web/Oracle-connection/td-p/69246
In the article there is an entry (7) giving a valid example of a connection to the Oracle database using ADO class

 

(b) Oracle ODBC Driver
https://www.progress.com/odbc/oracle-database
Using this driver allows you to set the appropriate 'Data Source' in the connection string.

 

(c) Correct 'Data Source' configuration
https://documentation.progress.com/output/DataDirect/odbcquickstarts/oracleodbc_win_quickstart/index.html#page/odbcoraclewin%2Fconfiguring-a-data-source.html%23wwID0EYLAI
Search for 'ODBC Administrator' service in Windows10 -> follow the instructions.

 

 

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Correct in case you are using Oracle ODBC driver.

    If you have Oracle OLE DB provider you may use pure ADO and provide relevant connection string.

    I did not go through the referenced links, but one must remember that the bitness of ODBC driver, DSN (and ODBC Administrator) and/or OLE DB provider *must* match the bitness of TestComplete.

     

    • Wamboo's avatar
      Wamboo
      Community Hero

      Hi

       

       
       
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Thanks for sharing your investigation with us Wamboo.

    I'll add this topic to the TechCorner area.