something wrong with your classpath I guess...
I get the below error which idicates that ur program is correct but is not recognising your class.
C:\java>javac MyConnection.java
C:\java>java MyConnection
Error 1
java.lang.ClassNotFoundException: com.informix.jdbc.IfxDriver
Error 2
java.sql.SQLException: No suitable driver
add JAVA_HOME environment variable.
also
have ' ;.; ' in your classpath
C:\java>
----Original Message Follows----
From: "[Vaishali S. Pandya]" <[EMAIL PROTECTED]>
Reply-To: A mailing list about Java Server Pages specification and reference <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Working with JSP not with JAVA
Date: Tue, 30 Apr 2002 14:23:32 +0530
MIME-Version: 1.0
Received: from [192.18.99.108] by hotmail.com (3.2) with ESMTP id MHotMailBE982E0200AF40043193C012636C95E30; Tue, 30 Apr 2002 11:32:06 -0700
Received: from swjscmail1 (swjscmail1.Sun.COM [192.18.99.107])by swjscmail2.java.sun.com (Postfix) with ESMTPid C3574229D8; Tue, 30 Apr 2002 03:16:10 -0600 (MDT)
Received: from JAVA.SUN.COM by JAVA.SUN.COM (LISTSERV-TCP/IP release 1.8d) with spool id 1505350 for [EMAIL PROTECTED]; Tue, 30 Apr 2002 03:14:49 -0600
Received: from mail.ril.com (unknown [202.54.16.41]) by swjscmail1.java.sun.com (Postfix) with ESMTP id 0AF0D481B for <[EMAIL PROTECTED]>; Tue, 30 Apr 2002 03:14:47 -0600 (MDT)
Received: from smtpgate.maker.bom.ril.com (smtpgate.ril.com [10.200.0.254]) by mail.ril.com (8.11.3/8.11.2) with ESMTP id g3U9Axq05914 for <[EMAIL PROTECTED]>; Tue, 30 Apr 2002 14:40:59 +0530
Received: from notes.ril.com (localhost.localdomain [127.0.0.1]) by smtpgate.maker.bom.ril.com (8.12.0/8.12.0) with ESMTP id g3U9JAFF002782 for <[EMAIL PROTECTED]>; Tue, 30 Apr 2002 14:49:10 +0530
From [EMAIL PROTECTED] Tue, 30 Apr 2002 12:10:14 -0700
Delivered-To: [EMAIL PROTECTED]
X-Mailer: Lotus Notes Release 5.0.8 June 18, 2001
X-MIMETrack: Serialize by Router on MKR_LN02/RIL(Release 5.0.8 |June 18, 2001) at 04/30/2002 02:45:59 PM
Message-ID: <[EMAIL PROTECTED]>
Sender: A mailing list about Java Server Pages specification and reference <[EMAIL PROTECTED]>
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
.
===========================================================================
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