Bookmark Topic Watch Topic
  • New Topic

confusion in running the program

 
yogi maheshnath
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

when i am running the following code on command line,i am getting Exception in thread"main"java.lang.NoClassDefFoundError emosql.But,when i am running this code on IDE there is no error.Please explain.
---------------------------------------------------------------------------
import java.sql.*;
public class demosql
{
Connection con;
ResultSet rs;
Statement st;
demosql()
{

try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc dbc:mydsn");
st=con.createStatement();
rs=st.executeQuery("select name from emp");
while(rs.next())
{
String str=rs.getString(1);
System.out.println(str);
}
}
catch(Exception e)
{}

}
public static void main(String args[])
{
new demosql();
}
}
-------------------------------------------------------
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please continue under the duplicate post, and please don't post duplicates.
 
    Bookmark Topic Watch Topic
  • New Topic