Does anyone know how to connect a distant oracle database with Robot Framework?

I tried to use cx_Oracle, but I couldn't install it, I have this message error : "cannot locate an Oracle software installation", and yes, I don't have an Oracle server on my PC, I just have sqlDeveloper to test my queries. But I would like to make some queries with robot Framework on this distant database, is this possible?

Answers


I successfully use cx_Oracle to access an Oracle database using the DatabaseLibrary. On a Windows platform, you

  1. install the thin client
  2. to the system PATH, add the path to the instant client folder
  3. install cx_Oracle

Connecting to the database for our setup looks like this: Connect To Database Using Custom Params cx_Oracle user='bob', password='letmein', dsn='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=sql1.mycompany.com)(PORT=1521)))(CONNECT_DATA=(SID=warehouse)))'


Install miniconda python distribution which makes it much easier. It comes with conda package manager as alternative to pip. Installing cx_oracle including instant client is then just this easy:

 conda install oracle-instantclient
 conda install cx_oracle

It will automatically download matching DLL files and place it to condo root directory. This way you do not have to stuggle with ORACLE_HOME, PATH variables and 32-bit vs. 64-bit mismatch of python and oracle DLL drivers.

Using it in robotframework example:

*** Settings ***
Documentation  Basic database related keywords
Library  DatabaseLibrary

*** Variables ***
${DB_CONNECT_STRING} =  'user/mypasswd@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myipaddress)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=mysid)))'

*** Keywords ***
Connect
    connect to database using custom params  cx_Oracle  ${DB_CONNECT_STRING}

Disconnect
    disconnect from database

Yes it is possible.

2 solutions:

  1. use odbc drivers and pyodbc

  2. use jtds drivers and jaydebeapi:

    ${jdbcDriver} Set Variable '${jdbcDriversPath}/ojdbc6.jar' Connect To Database Using Custom Params jaydebeapi 'oracle.jdbc.driver.OracleDriver', ['jdbc:oracle:thin:@//${DB_HOST}:${DB_PORT}/${DB_SSID}','${database}','${DB_PASSWORD}'],${jdbcDriver}


Installing the 32-bit versions of the following solved the issue for me:

  • Instant Client Package - Basic
  • Instant Client Package - SDK

I don't know for what reason but 64-bit versions of the Oracle client didn't work for me.


Need Your Help

cache in asp.net (output)?

c# asp.net caching

in my application i trying to implement the cache (ouput) but it is not working fine,