Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

jdbc issue using OCI8 driver

Ciaran Byrne
Advisor

jdbc issue using OCI8 driver

Hi,
I have a problem on HP-UX 11i connecting to an Oracle 8.1.7.2 database. The client can connect using the Oracle jdbc thin client but not the OCI8 client. The error message is "java.sql.SQLException: ORA-12154: TNS:could not resolve service name". However I can do a 'tnsping SID' and sqlplus to the database. Any ideas/suggestions would be appreciated.
2 REPLIES
Brian Bientz
Advisor

Re: jdbc issue using OCI8 driver

I suspect that there is something wrong with the connect string in the java program. If I'm not mistaken, the connect string for the OCI8 driver is different from the connect string for the JDBC Thin driver. I think I would try putting some debug statements in the Java code to ensure the proper connect string is being passed to the driver. Another option would be to turn on SQL*Net (Net8) client tracing. The trace file would show you exactly what connect string is being passed. Hope this helps.
Ciaran Byrne
Advisor

Re: jdbc issue using OCI8 driver

Brian,
thanks for your response. I found the issue was with the way the driver was registered.
Needs to be
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

which is different than for the thin driver.

Thanks,