Recently we migrated to a environment with [Linux Servers (Virtual machine set up),JDK1.5 & Oracle 11g ].I have an application which establishes a thin client connection from Java (like as below) to Oracle 11g database.
OracleDataSource ods = new OracleDataSource();
Connection conn = ods.getConnection();-----Failure point ---------------
However I face runtime issues intermitently exactly at the point "ods.getConnection() " and code doesn't enter my exception block.However this happens very intermittently and not always too ... .The same application was running fine in the previous environment [Unix servers,JDK1.5 & Oracle 10g]
There are two jars present in my lib (ojdbc14.jar and classes12dms.jar).
1) I am not sure whether there is a conflict in picking up these jars ...? Is there any relation between JDK version(JDK1.5) AND JDBC Driver Version(ojdbc14.jar) AND classes12.jar ?
2)Is it a mandate that ojdbc5 version of jar to be used with Jdk1.5 -Oracle 11g?
Edit: since this is a sporadic issue... I'm thinking maybe the DB is simply refusing or rejecting connections. Not sure why no Exception of some sort is thrown, but can you find out anything from the Oracle logs? Normally ojdbc14_g.jar can be used to provide more details in the stacktrace, assuming an Exception occurs within the driver.
Joined: Mar 12, 2012
Thanks for the quick response.We are not using ODMS services in our project and also don't see anything weird in DB logs.
1) The standalone java jar I am using is kept under lib directory which is basically the library directory of a web application and it has so many other libray jars and few custom java jars.There is ojdbc14.jar as well as classses12.jar under lib directory. Will this cause any problem if at all ?
2)Also my old environment set up is UNIX-Oracle10g-32bit Java and new environment is Linux-Oracle11g-64bit Java.Could there be a possibility of an issue at this level ? Are there any 64bit ojdbc driver jars that need to be used ? Reason being things worked fine in old environment and once moving on to the new environment,I have started observing this weird issue.Sometimes it works and few times it doesn't
3)I am able to see exception trace for only one particular java stand alone application,however for the others I am not able to see any logs.Most of the time that application works and if at all it fails,I see the
the below message followed by trace which exactly ends at the line
Instead of ojdbc14.jar, you might want to try ojdbc14dms.jar or ojdbc15dms.jar instead.
I think in the end the only thing you need is either ojdbc14dms.jar or ojdbc15dms.jar. Nothing else.
Joined: Mar 12, 2012
Thanks once again for the prompt reply.I will try the option of removing classes12.jar . I have tried options of using ojdbc14dms.jar in the past,but did not find any success.I can try the same again.
Also I have a couple of questions regarind the error ,
1)When I try to view the contents of ojdbc14dms.jar ,I do not find the package (oracle/dms/instrument) nor the class (ExecutionContextForJDBC) in it ?
2) I also have classes12dms.jar present under the library along with classes12.jar.There is a jar by name dms.jar itself (no clue where this is distributed,but as per my reading it looks like it is supplied along with Oracle application server).But none of these jars have the package 'oracle/dms/instrument' at all .I am wondering how this is not coming up in my old environment(Oracle 10g with 32-bit java compiler)
Pasting the complete Exception Trace: This error does not come up always,it is intermittent and the failure rate is sometimes 1 out of 10 or even 1 out of 5 at times
Once again ,your help on this is very much appreciated.
Remove all jar files related to Oracle DB from your app lib folder. Also make sure your classpath doesn't include any other DB jars from anywhere else (i.e. app server).
Then try again with just ojdbc5.jar. If that doesn't work, try with just ojdbc5dms.jar. If that doesn't work, do a search for file "dms.jar" somewhere under the Oracle jdbc directory. Then copy that file to include in your classpath. Use that file in addition to one of ojdbc5dms.jar or ojdbc5.ja (try which one).
Joined: Mar 12, 2012
Thanks a lot.I removed both the jars (classes12.jar & classes12dms.jar) from my library and just retained ojdbc14.jar.
I automated lot of tests and now things to seem work fine ,I havent seen the intermittent DB connection failures for the past two days.