This topic contains 1 reply, has 2 voices, and was last updated by  Garry Christensen 1 year, 6 months ago.

Oracle Settings?

  • Hi everyone,

    I’m having issues integrating Oracle with Iguana, and it seems like it is a configuration problem with Oracle, has anyone had luck using Oracle with Iguana and pushing data to it straight from Iguana?

    Josh

    Hi Josh,
    The key probably lies in your connection string. It will depend on whether Oracle is configured for a Service Name or SID. I’ve included both formats in this function

    require('retry')
    OracleDB = {}
    
    OracleDB.sServer = 'OracleHostName'
    OracleDB.sDbUser = 'User'
    OracleDB.sDbPassword = 'password'
    function OracleDB.Connection(bLive)
       if not bLive then
          bLive = true
       end
       
       sServiceConnection = [[(DESCRIPTION = 
       (ADDRESS = (PROTOCOL = TCP)
       (HOST = ]] .. OracleDB.sServer .. [[)
       (PORT = 1521))
       (CONNECT_DATA = (SERVER = DEDICATED)
       (SERVICE_NAME = MYSERVICE.NAME)))]]
    
       sSIDConnection = [[(DESCRIPTION = 
                          (ADDRESS = (PROTOCOL = TCP)
                             (HOST = ]] .. OracleDB.sServer .. [[)
                             (PORT = 1521))
                          (CONNECT_DATA = (SERVER = DEDICATED)
                              (SID = MYSID)))]]
       -- choose the right connection string for the name parameter below
       local bError, dbCon = pcall(retry.call,{func=db.connect, retry=2, pause=1, arg1={api=db.ORACLE_OCI, name=sXXXXConnection, user=OracleDB.sDbUser, password=OracleDB.sDbPassword, live=bLive}})
       if dbCon.query then
          return dbCon
       end
    end

You must be logged in to reply to this topic.