• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable Connect from servlet-jdbc to Oracle

 
kris iyer
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I am using j2ee server and oracle database, i wrote a servlet to connect to oracle database using jdbc(type 4 drivers)
But when i run the servlet thru my browser I get the following error
Exception Report:
javax.servlet.ServletException: JDBC Driver not found.
Root Cause:
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

I feel that it's not getting the jdbc location....
I even wrote another small program to check if jdbc works and it's working
Therefore I am confused why is it not working
can anyone tell me why is it working ? and is it necessary to do someother settings
thanks

kris
 
Mahesh Mamani
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Have u checked the value of Path variable in the J2EE server??? Check it and try again...Some problem in Ur environment settings itself...
Try it...

Mahesh
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a slight complication with Oracle in regards to many application servers.
App servers (or servlet containers) like to load the libraries on their own (rather than relying on the classpath) since it allows them to create and manage application contexts so that they aren't all running off the same code-base.
They do this by detecting and loading all of the jars in certain locations (eg .../server/lib and .../common/lib and .../webapps/[ app_context ]/web-inf/lib in Tomcat 4)
The problem with Oracle is that the code is provided as a .zip and not as a .jar
The two are generally compatable, but it can't be found by the application because it doesn't end with .jar
The simplest solution is to rename the file (eg classes111.zip) to be a .jar then drop in the right place for the app server to find...
Dave
 
kris iyer
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mahesh/dave
Thanks guys for ur help...I was able to run my servlet , David i changed my .zip to .jar but again it was giving the same error then i changed the J2EE_CLASSPATH in userconfig.bat and ran it before my J2EE server....then it was able to find the jdbc path and i was able to connect to database
I had a small doubt ...is it necessary to run userconfig.bat file everytime or does it run automatically (that's when i start j2ee server)?
thanks

kris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic