Logstash connection with Oracle wallet

217 Views Asked by At

I'm having issues connecting Logstash using Oracle wallet. I am getting an invalid login/password even though I am trying to connect through the wallet, without using said login/password.


[ERROR][logstash.inputs.jdbc ] Unable to connect to database. Tried 2 times {:error_message=>"Java::JavaSql::SQLException: ORA-01017 Invalid Username/Password"}

Here's my Logstash jdbc input file :

input {
    jdbc {
        jdbc_driver_library => "${ORACLE_HOME}/dmu/jlib/ojdbc10.jar,${ORACLE_HOME}/ucp/lib/ucp.jar,${ORACLE_HOME}/jlib/oraclepki.jar,${ORACLE_HOME}/jlib/osdt_cert.jar,${ORACLE_HOME}/jlib/osdt_core.jar"
        jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
        jdbc_connection_string => "jdbc:oracle:thin:/@name_high?TNS_ADMIN=${ORACLE_HOME}/network/admin/wallet"
        jdbc_user => ""
        schedule => "* * * * * *"
        statement => "SELECT * from table"
        connection_retry_attempts => 2
        connection_retry_attempts_wait_time => 5
        jdbc_pool_timeout => 20
        jdbc_validation_timeout => 600
    }
}

So I use the following drivers :

  • ojdbc10.jar

  • ucp.jar

  • oraclepki.jar

  • osdt_cert.jar

  • osdt_core.jar

  • I made sure every environement variable paths are correct, every access rights correctly set.

  • I believe the connection string syntaxe is correct since it does find the tnsnames.ora and attempt a connexion to the right host, port, sid.

  • I omitted the field jdbc_password in the jdbc input as it is not required and I don't want jdbc to think I want to use it. I left the jdbc_user field but empty as it is apparently required even though I'm trying not to use it.

  • I'm able to connect to the database using sqlplus as follows:

    sqlplus /@name_high

2

There are 2 best solutions below

0
On

So what I was missing was the java property wallet_location wich append to be the same path as the TNS_ADMIN in my case.

It needs to be loaded by the script that launch the JRE when starting Logstash as such :

-Doracle.net.wallet_location=${WALLET_PATH}

0
On

You can refer to the blog for steps with different versions of the driver. Also, you can refer to the blog to know different ways to set connection properties.