Problem in connection with Oracle without ODBC using Think DriverFollowing code is not workinggiving error Exception in thread Main java.lang.NoClassDefFoundError:jdbc1import java.sql.*;class jdbc1 { public static void main(String args[]) { try{ Class.forName("oracle.jdbc.driver.OracleDriver"); Connection c=DriverManager.getConnection("jdbc:oracle:thin:@hostname:1521:sid","scott","tiger" ); Statement s=c.createStatement(); ResultSet rs=s.executeQuery("select * from books"); while(rs.next()) {System.out.println("dno="+rs.getString(1)+"t"+"dname="+rs.getString(2)+"t"+"loc="+rs.getString(3)); } }catch(Exception e){System.out.println(e);} } }

Showing Answers 1 - 2 of 2 Answers

kishore

  • Sep 12th, 2006
 

 Check oracle TNS names which u can find in ora90...installed path of oracle.

  Was this answer useful?  Yes

vykuntarao

  • Oct 3rd, 2006
 

for sovlinig this problem u has to use the environment variable "CLASSPATH".

first u copy the ralated jar file in to current direcory and set the class path using the command  "set CLASSPATH=%CLASSPATH%;LOCATION OF JAR FILE;.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions