search cancel

The SQL agent throws an exception after startup: no ocijdbc12 in java.library.path


Article ID: 106268


Updated On:


CA Automic One Automation


When trying to start the SQL Agent and connect to the Oracle database, immediately after starting, the agent throws the following error message:
/opt/uc4/java/jre1.8.0_131/bin/java -Xrs -Xmx256M -jar /opt/uc4/agent-sql/ucxjsqlx.jar -i/opt/uc4/agent-sql/ucxjsqlx_oracle_EXP2-A.ini -Djava.library.path=/opt/oclient/default/lib:/opt/oclient/default/jlib 
com.uc4.ex.sql.ConnectionException: java.lang.UnsatisfiedLinkError: no ocijdbc12 in java.library.path 
at com.uc4.ex.sql.ConnectionManager.getConnection( 
at com.uc4.ex.sql.SQLConsumer.ensureConnection( 
at com.uc4.ex.sql.SQLConsumer.execute( 
at com.uc4.ex.ThreadPool$ 
at java.util.concurrent.Executors$ 
at java.util.concurrent.ThreadPoolExecutor.runWorker( 
at java.util.concurrent.ThreadPoolExecutor$ 


SQL Agent connected to an Oracle database 


Wrong or too many ojdbc*.jar files in the agent's jdbc sub directory. The jdbc directory is located in the agent’s bin folder (e.g.: … automation.engine/agent-sql/jdbc)

The agents search during the startup process in the jdbc subdirectory for the database driver. If you have more than one ojdbc*.jar file located in this directory the agents use the file in a random order.

If for example:
ojdbc8.jar are located in the jdbc subdirectory it might be possible that the agent uses the false ojdbc*.jar driver 

When a connection to the DB is required, the JDBC driver searches the paths specified in LD_LIBRARY_PATH for the OCI shared libraries. Crucially, different versions of the Oracle JDBC driver require different versions of the Oracle OCI client. 

In the described error above the problem was that the highest numbered jdbc file in the jdbc subdirectory was used (ojdbc8.jar)
And therefore, this error was thrown:
com.uc4.ex.sql.ConnectionException: java.lang.UnsatisfiedLinkError: no ocijdbc12 in java.library.path


To resolve such issue please try the following steps:
*remove all ojdbc*.jar files from the jdbc subdirectory of the SQL agent directory except the one you want to use.
*adjust the relevant environment variables:
$ export PATH=/bin:/usr/bin:/usr/local/bin:/opt/uc4/utilities/bin:/opt/oclient/default/bin:/opt/uc4/agent-sql
$ export LD_LIBRARY_PATH=/lib:/usr/lib:/opt/oclient/default/lib

*restart the agent

Additional Information