• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

database access problem

 
sneha nimmala
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my programe like this:-
i was setting classpath:-

C:\Java\jdk1.5.0_07\lib;C:\Tomcat 5.0\common\lib\servlet-api.jar;C:\Tomcat 5.0\common\lib\jsp-api.jar;C:\Tomcat 5.0\common\lib\struts.jar;C:\bea\weblogic81\common\lib;G:\oracle\ora92\jdbc\lib\nls_charset12.zip;G:\oracle\ora92\jdbc\lib\ojdbc14.jar;C:\Java\jre1.5.0_07\lib;.



import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

/**
* @author Administrator
*
*/
public class Test {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection(
"jdbcracle:thin:@localhost:1521raglob", "scott", "tiger");
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("select id,name from emp");
while (rs.next()) {
System.out.println("result");
System.out.println("id:" + rs.getString(1));
System.out.println("Name:" + rs.getString(2));
}
} catch (Exception e) {
System.out.println("e=" + e);
}
}

}

I AM GETTING eXCEPTION:-
e=java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver


PLEASE SEND SOLUTION FOR ABOVE EXCEPTION
 
Amit M Tank
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Check your classpath for the above jars. Do you really have a G: drive?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic