Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

plz help about JDBC

  Asked By: James    Date: Mar 09    Category: Java    Views: 853
  

here is my code


import java.sql.*;

class database
{
public static void main(String args[])
{
try
{

DriverManager.registerDriver(new
oracle.jdbc.OracleDriver());
Class.forName ("oracle.jdbc.driver.OracleDriver");

Connection con =
DriverManager.getConnection("jdbc:oracle:oci8:@pr315","PR315_human",
"PR315_human");

Statement stmt = con.createStatement();

String query = "SELECT * FROM DRUGS";
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
String s = rs.getString("GENERIC_NAME");
System.out.println(s );
}
}
catch(Exception e)
{
System.out.println(e);
}
}

}

i am getting the error

D:\java programs\pr315\database.java:11: package
oracle.jdbc does not exist

DriverManager.registerDriver(new
oracle.jdbc.OracleDriver());

i am using jdk1.4.1 and oracle 8i

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Stacie Martin     Answered On: Mar 09

hey r u sure u have kept the classes12.jar(which has the drivers) in the
classpath before running the program

 
Didn't find what you were looking for? Find more on plz help about JDBC Or get search suggestion and latest updates.




Tagged: