Sarada Akurathi
Sarada Akurathi

Reputation: 1188

When run the Connect to Oracle Database using jybot getting the error cx_Oracle is not found

I tried to run the Query from Oracle Database using jybot option as i have some java custom code, that need in my test script along with query from oracle database.

I got the error cx_Oracle is not found.

When run the same using pybot (removed the java custom code) then i didn't get any errors.

If i run the java custom code alone using jybot then also no errors.

Steps i followed to install Database Library are as follows:

Install Visual C++ Compiler

  1. Download and Install VCForPython27.msi (If not have the executable file, please check Important URLs section for link to download)

  2. Set Environment Variables ORACLE_HOME, TNS_ADMIN if not setup already.

Install Database Library

Open the command prompt and run the following command

pip install robotframework-databaselibrary

Install cx_Oracle

Open the command prompt and run the following command

pip install cx_Oracle

Connect to Oracle Database Code:

Connect To Database Using Custom Params    cx_Oracle    '${Username}/${Password}@${Host}:${Port}/${DatabaseName}'

@{Numbers}    Query    SELECT NUMBER_V from MASTER_DB WHERE STATUS_V='F' and ROWNUM <= 10

Log    ${Numbers[0]}

Any one, please help me how to run the query from oracle database using jybot.

Thanks Sarada

Upvotes: 0

Views: 1123

Answers (1)

bp3
bp3

Reputation: 245

cx_Oracle can't be sucessfully used under the jybot

Here is my solution:

  1. Install DatabaseLibrary module by

    pip install robotframework-databaselibrary
    
  2. Install JayDeBeApi module by

    pip install JayDeBeApi
    
    • now you can put these libraries anywhere you like - just copy them from Python\Lib\site-packages
  3. And here is going the trick! The DatabaseLibrary usage have following sample for jaydebeapi connection:

    Connect To Database Using Custom Params | JayDeBeApi | 'oracle.jdbc.driver.OracleDriver', 'my_db_test', 'system', 's3cr3t'
    

However this is wrong! You have to use the brackets over the username-pass pair! Like this:

Connect To Database Using Custom Params | JayDeBeApi | 'oracle.jdbc.driver.OracleDriver', 'my_db_test', ['system', 's3cr3t']

And please do not forget to use URL connection instead of my_db_test! It should be like this:

jdbc:oracle:thin:@//127.0.0.1:1521/my_db_test

Regards

Upvotes: 1

Related Questions