Discussion Locked

Error while running Java program

0 helpful
0 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi friends
Iam new to Java technology.
When I tried to retrieve records from Oracle database to Java using ODBC, the compilation is successful. But I'm getting an error while running the program.
I'm getting output for this program in other systems in which the system JavaHome variable is set as C:\jdk1.3 whereas in my sytem, the variable is C:\j2sdk1.4.0_01

The error is:
Exception in thread "main" java.lang.NoClassDefFoundError: Ret/Class

My program is:
import java.sql.*;
public class Ret
{
public static void main(String a[]) throws Exception
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:team2","scott","tiger");
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("Select * from emp");
while (rs.next())
{
String str = rs.getString("ename");
String j = rs.getString("job");
System.out.println(str+" "+j);
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}

0 replies

No replies were posted before this discussion closed.

This discussion is closed to new replies.