General discussion

Locked

Error while running Java program

By prasannakumar ·
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);
}
}
}

This conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Back to IT Employment Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums