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.