File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FOR HELP, can not connect to Oracle using JDBC in servlet.

 
Chris Ben
Ranch Hand
Posts: 135
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I got pretty frustrated while working on servlet and JDBC recently and hope some experts can help me out.
I am trying to connect to a oracle database using servlet, which is hosted by Tomcat, UNIX server.
I have no right to play with the server so I copy the whole directory of oracle thin driver to my servlet class directory from others, looks like unzipped class12.zip.
I am not sure whether that is the right driver, but I have no problem to connect to the oracle in the stand along application (in main method) in UNIX. However, after I tried to put the same codes in the doGet() of my servlet and call it from the browser, I got error as "No suitable driver".
I tried to debug my codes, it appears the following codes are OK
try
{
driver = Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch (java.lang.ClassNotFoundException e)
{
return "Driver not found";
}
Seems soemthing wrong with DriverManager.getConnection.
In addition, I got so frustrated that I wrote a server in the the same host and let the servlet in the same directory to open a socket to contact the server. Something make me mad is that I got message of Connection Refused in servlet though I have no problem in the stand alone program again.
I do not understand why driver cannot be found in servlet while it is working well in my application.
Do I need to ask the admin to modify some settings except for put the driver in my own servlet directory?
Or whatever else can I do?
Thanks for your help.
Chris

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic