Hi guys
Iwant to connect java to oracle ,but Iam not familiarneither jdbc nor in setting classpath
however depending on my little information,I used the following code
import java.sql.*;
public class OraThin {
public static void main(String[] args)
throws ClassNotFoundException, SQLException
{
Class.forName("oracle.jdbc.driver.OracleDriver");
//
// or
// DriverManager.registerDriver
// (new oracle.jdbc.driver.OracleDriver());
String url = "jdbc:oracle:thin:@computer-d219bd:1521:orcl";
Connection conn =
DriverManager.getConnection(url,"system", "overmars11");
conn.setAutoCommit(false);
Statement stmt = conn.createStatement();
ResultSet rset =
stmt.executeQuery("select BANNER from SYS.V_$VERSION");
while (rset.next()) {
System.out.println (rset.getString(1));
}
stmt.close();
System.out.println ("Ok.");
}
}
then I run the followin commands into dos command
C:\j2sdk1.4.1\bin>javac -classpath d:\oracle\product\10.2.0\db1\jdbc\lib c:\OraThin.java
C:\j2sdk1.4.1\bin>java -classpath d:\oracle\product\10.2.0\db1\jdbc\lib c:\OraThin
but I get the error:-
Exception in thread "main" java.lang.NoClassDefFoundError: c:\OraThin
Iwould be glad if someone help me.