- This topic has 11 replies, 2 voices, and was last updated 18 years, 11 months ago by Riyad Kalla.
-
AuthorPosts
-
Pichai.Raman@gmail.comMemberHey,
I am currently unable to connect to oracle. I just switched from sunserver to apache and have just started using myeclipse. I added ojdbc14.jar to my build path and the connection code is shown below. I was able to connect before with sunserver and a different IDE (although that shouldn’t matter). I don’t remember importing any other packages. I have also tried it with classes12.zip..no difference…I get the same basic error. help please.
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
public void getConnection()
{
try
{
Class.forName(“oracle.jdbc.driver.OracleDriver”);}
catch(Exception e)
{
System.out.println(“PROBLEM WITH DRIVER”);
e.printStackTrace();
}try
{con = DriverManager.getConnection(“jdbc:oracle:thin:xxx/yyy@zzz:aaa:bbb”);
con.setAutoCommit(false);
}
catch(Exception e)
{
System.out.println(“PROBLEM WITH CONNECTION”);
e.printStackTrace();
}}
Riyad KallaMemberMoving to OT > Soft Dev
You are getting a ClassNotFoundException so chances are you aren’t adding the oracle driver correctly to your build path, or you added it, then moved the JAR. Either way that seems to be the problem.
Pichai.Raman@gmail.comMemberI haven’t moved it. I have both ojdbc14.zip and classes12.zip in my build path. The odd thing is myeclipse obviously recognizes the packages or it wouldn’t even let me build in the first place as I’m declaring oracleresultsets and BLOB’s everywhere. Yet it fails to find
oracle.jdbc.driver.OracleDriver. I’m just adding both ojdbc14.zip and classes12.zip as archives to my project.
Riyad KallaMemberIs this client code or web code? If it’s web code you need to place your drivers into your app server’s lib directory so the app server can pickup the classes. For tomcat that is common/lib
Pichai.Raman@gmail.comMemberOkay added both classes12.zip and ojdbc14.zip to common. Still get the same error. I’m completely baffled.
Pichai.Raman@gmail.comMemberI meant added to common/lib
Riyad KallaMemberAs a last ditch effort try and add them to WEB-INF/lib and deploy. I have no idea why this isn’t working.
You sure you are launching the install of Tomcat you think you are? (I’ve done that, had two installs and been modifying the config of a separate install and keep relaunching the old one and going crazy)
Pichai.Raman@gmail.comMemberIs there any other information that might be of use to help solve this problem. Is there any other zips I need perhaps. I’ve restarted and shutdown my server a number of times to no avail.
Riyad KallaMemberPichai,
This is a straight forward issue; ClassNotFoundException. The fact that it is taking this long to figure out with only 2 possible solutions makes me thing the problem is something even sillier than we might think it is.For example, you have setup your Tomcat connector to launch the wrong Tomcat instance.
You are launching JBoss but keep making changes to Tomcat.
stuff like that.
I would say go back to basics. Go download Tomcat 5.5.9 ZIP, unzip it to a new dir, go configure your Tomcat 5 connector to point at it (e.g. C:\temp\tomcat-5) then run it. Make sure it starts up alright. Now stop it.
Now go drop the oracle drivers into common/lib dir of the new tomcat install, now deploy your app to it and start it back up, now try and connect.
Pichai.Raman@gmail.comMemberI found out what was happening…it still makes no sense to me but it works now…just put ojdbc14 jar into the common\lib instead of ojdbc zip. Very silly error. I just didn’t know that tomcat
Pichai.Raman@gmail.comMemberjust didn’t know that tomcat didn’t recognize zip files
Riyad KallaMemberOdd. Glad it’s working now.
-
AuthorPosts