I have writen a connection class in .java and created a class file
the same code i have writen in jsp and import it whenever required.
in jsp it is working but when i try to run class file it gives me error
like
import java.lang.*;
import java.sql.*;
public class MyConnection{
public static void main(String s[]){
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
String code = "";
String name = "";
try{
Class.forName("com.informix.jdbc.IfxDriver");
}
catch(Exception e){
System.out.println("Error 1");
System.out.println(e);
}
try{
con=DriverManager.getConnection("*************");
stmt = con.createStatement();
rs = stmt.executeQuery("SELECT emp_login_id,emp_name FROM
login_mst");
while (rs.next()) {
code = rs.getString("emp_login_id");
name = rs.getString("emp_name");
System.out.println(code);
System.out.println(name);
}
// return stmt;
}
catch(Exception e){
System.out.println("Error 2");
System.out.println(e);
}
}
}
javac MyConnection.java
java MyConnection
Exception in thread "main" java.lang.NoClassDefFoundError: MyConnection
why?
Regards
Vaishali
Reliance Industries Ltd.
India
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com