Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unable to connect to Personal Oracle 9i database

843854Apr 24 2003 — edited May 1 2003
I have loaded Borland Jbuilder 8 and Oracle 9i Release 1 Personal Edition in WinXP
When i try to compile the below code , i get the Error
Exception in thread "main" java.lang.NoClassDefFoundError
I have set my CLASSPATH to c:\oracle\ora90\jdbc\lib\classes12.zip

import java.sql.*;
class Employee
{
public static void main (String args [])
throws SQLException
{
// Load the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());

String url = "jdbc:oracle:oci8:@test";
try {
String url1 = System.getProperty("JDBC_URL");
if (url1 != null)
url = url1;
} catch (Exception e) {
}

Connection conn =
DriverManager.getConnection (url, "scott", "tiger");

Statement stmt = conn.createStatement ();

ResultSet rset = stmt.executeQuery ("select ENAME from EMP");

while (rset.next ())
System.out.println (rset.getString (1));

rset.close();
stmt.close();
conn.close();
}
}

Is there anything else i have to do. I even tied compiling from command line but i got the same error. Any help will be higly appreciated
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 29 2003
Added on Apr 24 2003
26 comments
344 views