• Post Reply Bookmark Topic Watch Topic
  • New Topic

Connect to Oracle 8i Database  RSS feed

 
Zahid, Butt
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
How do I connect to the Oracle Database from my servlet ??
what import statements do I need. Where can I get hold of the
JDBC Thin Client Driver for free/ how do I install it ??

Thanks in advance.
 
Beksy Kurian
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can go to technet.oracle.com to get the jdbc drivers. put the classes12.zip in the classpath.
Import statements are:
import java.sql.*;
import oracle.sql.*;
import oracle.jdbc.driver.*;
And add the following in your doget or init method...
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc racle:thin:@hostname:1521:sid";
myConnection= DriverManager.getConnection(url, "user", "password");
Beksy
 
Zahid, Butt
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thanks for your reply. Which directory in the classpath do I put the zip file, c: , d: ?
Please reply ASAP.
Thanks in advance.
 
Zahid, Butt
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thanks for your answer. Compiling the file is not a problem, but when I run the file the following error message appears
"java.lang.NoClassDefFoundError: oralce/jdbc/driver/OracleDriver"
How do I sort this one out ??
Thanks in advance.

 
Syed Khan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks as if the classes12.zip file isn't on the classpath of the Web Server your servlet is running on. Copy the file to the classpath of the Web Server (e.g. lib dir in Tomcat)
 
Zahid, Butt
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
The problem is, I am running my servlet using JSDK - the Servlet Runner and not a Web Server.
Any help ???

Thanks in advance.
 
Manohar Karamballi
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keep class12.zip in classpath of ur system...
 
Zahid, Butt
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Done that, but it still doesnt work.
Zahid.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!