views:

125

answers:

2

I get the following error when I run a java program:

Exception in thread "main" java.lang.UnsatisfiedLinkError: t2cPingDatabase
        at oracle.jdbc.driver.T2CConnection.t2cPingDatabase(Native Method)
        at oracle.jdbc.driver.T2CConnection.doPingDatabase(T2CConnection.java:503)
        at oracle.jdbc.driver.PhysicalConnection.pingDatabase(PhysicalConnection.java:4886)
        at oracle.jdbc.driver.PhysicalConnection.pingDatabase(PhysicalConnection.java:4899)
        at oracle.jdbc.pool.OracleImplicitConnectionCache.testDatabaseConnection(OracleImplicitConnectionCache.java:2174)
        at oracle.jdbc.pool.OracleImplicitConnectionCache.performPooledConnectionTask(OracleImplicitConnectionCache.java:1343)
        at oracle.jdbc.pool.OracleImplicitConnectionCache.doForEveryCachedConnection(OracleImplicitConnectionCache.java:1208)
        at oracle.jdbc.pool.OracleImplicitConnectionCache.refreshCacheConnections(OracleImplicitConnectionCache.java:1848)
        at oracle.jdbc.pool.OracleConnectionCacheManager.refreshCache(OracleConnectionCacheManager.java:480)
        at tkpjb7382521.refreshConnectionPool(tkpjb7382521.java:199)
        at tkpjb7382521.test(tkpjb7382521.java:115)
        at tkpjb7382521.run(tkpjb7382521.java:46)
        at sqlj.qa.harness.AppJdbcHarness.RunTestCase(AppJdbcHarness.java:158)
        at sqlj.qa.harness.AppJdbcHarness.main(AppJdbcHarness.java:79)

What could be the possible reason for this?

+6  A: 

Java throws this error when it can't find a native method referenced in a jar. So my guess is you're using the native (OCI) Oracle JDBC driver with a missing or incorrectly configured Oracle client configuration or your URL is incorrect or you're simply missing entries from your tnsnames.ora file.

The easiest solution is probably just to use the Oracle thin JDBC driver instead, which doesn't require the Oracle TNS client to be installed.

cletus
+3  A: 

There is a call to native method t2cPingDatabase made and looks like the JVM is unable to find the native method definition. Could be a library path issue.

codaddict