I want to write a java code that connects with Oracle database using host,pid,address information from tnsnames.ora file using jdbc thin driver. I dont want to hard code any of these values accept SID.
As per my findings,JDBC thin driver doesnt reads these values from tnsnames.ora file.The usual
doesnt work for me since I have to get host,port values at runtime.
Also as per my understanding OCI driver should be used if tnsnames.ora file needs to be referred by program. I dont want to use OCI since it needs extra installation stuff. I want to make connection with JDBC thin driver only.
So I thought of using OracleDatasource contained in package : oracle.jdbc.pool
I want to know is OracleDatasource is the best way to make connection with Oracle database when tnsnames.ora file needs to be used in my case?
is it mandatory for you to get the database properties from tnsnames.ora only?
how about configuring the db details in a properties files & continuing with thin driver only?
Joined: Mar 04, 2008
Ya..thats the requirement i am having. Earlier code was reading these values from a property file and that property file was required to update manually everytime there were some changes in host values. To get rid off of that manual updation, I decided to use tnsnames.ora file directly.
So it is mandatory for me to use tnsnames.ora file only.
Still facing the Exception , I am surprised how come you overcome this, May be I have to switch to some other driver too
Exception in thread "main" java.sql.SQLException: Io exception: SO Exception was generate