my dog learned polymorphism
The moose likes JDBC and Relational Databases and the fly likes problem with jdbc drivers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "problem with jdbc drivers" Watch "problem with jdbc drivers" New topic

problem with jdbc drivers

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
My jdbc program does not create a table with oracle8.
import oracle.jdbc.driver.*;
gives an error " opackage not found".
what are the system requirements .
please hepl.step by step will be i am new to jdbc
Suresh Selvaraj
Ranch Hand

Joined: Nov 14, 2000
Posts: 104
Here are the steps for connecting to Oracle database.
1.import the standard classes like*, java.sql.*, java.util.*...
2.Load the oracle driver.
3.Establish Connection to the database...
Connection con;
con=DriverManager.getConnection("jdbcracle:thin:@localhost:1521:ORCL", "userid", "password");
localhost ==> is your host number.
4.Create statement object...
Statement s = con.createStatement();
5.Construct an sql query:
String query = "select * from EMPTABLE;
6.Execute the query...
ResultSet rs = s.executeQuery(query);
7.Retrieve the values from the ResultSet object...
if (rs != null) {
while( {
String s1 = rs.getString(1);
String s2 = rs.getString(2);
if (con != null) {
try {
catch(SQLException e1) {}
if ( s != null) {
try {
catch(SQLException e1) {}

if ( rs != null) {
try {
catch(SQLException e1) {}

8.Statements 2 to 7 mentioned above should be in a try-catch-block.
try {
statements 2 thru 7
catch(SQLException e) {}
catch(ClassNotFounfException cnfe) {}
9.Ensure the ServerRoot\lib has the following libraries.
The ServerRoot\lib should have Servlet and JSP JAR files.
Also append the oracle.jar in the serverroot\lib classpath.
Hope this is in line with your requirements.
Suresh Selvaraj
[This message has been edited by Thomas Paul (edited March 21, 2001).]

Suresh Selvaraj, (author of JQuiz)<br />SCJP2<br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: problem with jdbc drivers
It's not a secret anymore!