Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.sql.SQLRecoverableException: Io exception: could not resolve the conne

user12119799Jul 12 2010 — edited Jul 12 2010
Hi,

My requirement is to connect through jdbc to the remote oracle server using the oracle wallet and using thin driver. For rhis i installed oralce client(11.1.0) in my machine and I created the wallet, And I tested the wallet using the sqlplus and I succeded in getting the connection. But when i tried to get the connection through jdbc am getting the exception like "java.sql.SQLRecoverableException: Io exception: could not resolve the connect identifier"low. Below am attaching the code.


public class OracleWalletTest
{
public static void main(String[] args)throws ClassNotFoundException,
SQLException
{
// We'll pretend that tnsnames.ora is in /mydir.
System.setProperty("oracle.net.tns_admin", "/opt/oracle/oracleClient/app/oracle/product/11.1.0/client_1/network/admin");
java.util.Properties info = new java.util.Properties();

// We'll pretend that the wallet is also in /mydir.
System.setProperty("oracle.net.wallet_location", "(SOURCE=(METHOD=file)(METHOD_DATA=(DIRECTORY=/opt/oracle/oracleClient/app/oracle/product/11.1.0/client_1/network/admin)))");

OracleDataSource ds = new OracleDataSource();

ds.setURL("jdbc:oracle:thin:@TEST123");
ds.setConnectionProperties(info);
Connection conn = ds.getConnection();
// Print the username out as some kind of prove it worked!
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select 'Hello Thin driver data source tester '||initcap(USER)||'!' result from dual");
if (rset.next())
System.out.println(rset.getString(1));
rset.close();
stmt.close();
conn.close();
}
}

I exported ojdbc5.jar, oraclepki.jar , osdt_core.jar , osdt_cert.jar into the CLASSPATH. Below is the stackstrace I got.

Exception in thread "main" java.sql.SQLRecoverableException: Io exception: could not resolve the connect identifier "TEST123"
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:101)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:458)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:411)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:490)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:202)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:465)
at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:275)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:206)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:156)
at OracleWalletTest.main(OracleWalletTest.java:36)


Please help me in fixing this.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 9 2010
Added on Jul 12 2010
1 comment
855 views