java.sql.SQLException: Problems with loading native library/missing methods: no ttJdbc1121 in java.library.path

When trying to execute a Java program that connects to remote Oracle TimesTen database you receive the following stack trace.

C:\app\oracle\product\Middleware\jdk160_14_R27.6.5-32\bin\javaw.exe -server -classpath E:\source\java\jdeveloper\TimeTenConnectionTesting\Client\classes;C:\app\oracle\product\TimesTen\tt1121_64\lib\ttjdbc6.jar -Djavax.net.ssl.trustStore=C:\app\oracle\product\Middleware\wlserver_10.3\server\lib\DemoTrust.jks com.oracledistilled.timesten.client.TTSimpleConnection
java.sql.SQLException: Problems with loading native library/missing methods: no ttJdbc1121 in java.library.path
	at com.timesten.jdbc.JdbcOdbcConnection.connect(JdbcOdbcConnection.java:1750)
	at com.timesten.jdbc.TimesTenDataSource.getConnection(TimesTenDataSource.java:148)
	at com.oracledistilled.timesten.client.TTSimpleConnection.main(TTSimpleConnection.java:20)
Process exited with exit code 0.

The machine running the program has the Oracle TimesTen client installed and a Client DSN has been configured for the remote database.

In this example the JDBC driver is not able to find the correct native library. Looking at the Java code we see the following code segment is used to make the connection.

    try {
      // connect to TimesTen database
      TimesTenDataSource ttds = new TimesTenDataSource();
      ttds.setUrl(/oracle-database/troubleshooting/java-sql-sqlexception-problems-with-loading-native-librarymissing-methods-no-ttjdbc1121-in-java-library-path/"jdbc:timesten:direct:dsn=sample;UID=odtest;PWD=password");
      TimesTenConnection ttcon = (TimesTenConnection) ttds.getConnection();

Notice that the URL is attempting a direct connection. In Oracle TimesTen there are two types of connections Direct and Client. Direct connections are intended to be made from applications running on the same server as the TimesTen Database. Client connections are connections from applications running on the database server or on remote machines.

The OracleTimes Client install does not have the native libraries required to make a direct connection. To resolve this error change the JDBC URL jdbc:timesten:direct:dsn=sample;UID=odtest;PWD=password from to jdbc:timesten:client:dsn=sample;UID=odtest;PWD=password .

Note: Direct is the default connection type so the URL may look like the following.
jdbc:timesten:t:dsn=sample;UID=odtest;PWD=password

4 thoughts on “java.sql.SQLException: Problems with loading native library/missing methods: no ttJdbc1121 in java.library.path”

  1. ttJdbcCS1122.dll is in bin please copy that to lib , now it will work if rest of configuration is correct.

    // /JDBC Driver
    static final String JDBC_DRIVER = “com.timesten.jdbc.TimesTenDriver”;
    static final String DB_URL = “jdbc:timesten:client:TTC_Server=serverIp;TTC_Server_DSN=DSN;TCP_PORT=PortNo”;

    // DB Credential
    static final String username = “***”;
    static final String password = “****”;

    System.out.println(“Registering database …”);
    Class.forName(JDBC_DRIVER);

    //Connecting to db
    System.out.println(“Connecting to database …”);
    conn = DriverManager.getConnection(DB_URL, username, password);

  2. Hi

    My ttJdbcCS1122.dll file is in both the bin and lib folders and I still get the error.

    oracle.odi.runtime.agent.invocation.InvocationException: oracle.odi.core.exception.OdiRuntimeException: java.sql.SQLException: Problems with loading native library/missing methods: no ttJdbcCS1122 in java.library.path

    Data Server is setup as follows:
    jdbc:timesten:client:dsn=EXA_PRD_TT

    Johan

  3. I have noticed you don’t monetize oracledistilled.com, don’t waste
    your traffic, you can earn additional bucks every
    month with new monetization method. This is the best
    adsense alternative for any type of website (they approve all sites), for more info simply search in gooogle:
    murgrabia’s tools

Leave a Reply

Your email address will not be published. Required fields are marked *