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!

Making JDBC TNS Connections To Oracle 11g

HugeBobNov 24 2013 — edited Jan 11 2014

Hello,

I'm a ColdFusion 8 (CF) developer trying to form a TNS connection to Oracle 11g. The CF service runs on a CentOS5 server. Here are the steps I've taken:

- Added -Doracle.net.tns_admin=/folder1/folder2/folder3/OracleTNS argument in my list of JVM arguments

- Placed the tnsnames.ora file in the folder referenced by the oracle.net.tns_admin setting

- Placed the ojdbc6.11.2.0.4.jar in the classpath, restarted CF and verified that CF detected and loaded it

- Implemented JDBC URL: jdbc:oracle:thin:@MyTNS.DB

- Driver class used: oracle.jdbc.OracleDriver

When I attempt the connection, I got the error:

Invalid connection string format, a valid format is: "host:port:sid". The root cause was that: java.sql.SQLRecoverableException: IO Error: Invalid connection string format, a valid format is: "host:port:sid"


I tested another driver that came with CF: the Macromedia driver. To get TNS to work with it, I used the following JDBC URL:

jdbc:macromedia:oracle:TNSNamesFile=/folder1/folder2/folder3/OracleTNS/tnsnames.ora;TNSServerName=MyTNS.DB

This connection worked! This demonstrates, at least, that the tnsnames.ora file is OK. So, my trouble seems to be working with the latest 11g driver ojdbc6.11.2.0.4.jar and the proper JDBC URL. I would just use the Macromedia driver. But, it's very old and I'd rather use the updated driver. If anyone has any ideas on what further steps I could make, please chime in.


Thanks

This post has been answered by sb92075 on Nov 24 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 8 2014
Added on Nov 24 2013
9 comments
9,251 views