oracle-databaserobotframeworkjython-2.7

How to connect Oracle database from Robot Framework without any client installed


Most solutions requires some client installed or cx_Oracle module using which is not appropriable as well - because i have to use Jython version of the Robot Framework


Solution

  • I'd researched a lot of posts just to have a very simple 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
    

    Hope it will helps someone! Good luck!