Hi JGurus,
Following is the my first Java sample program with JDBC. Compiling is ok but
while trying to execute I am getting strange error as (Exception in thread
"main" java.lang.NoClassDefFoundError: ConnectMe).
If any one can give a working sample with JConnect it will be very helpful.
#################################### SOURCE CODE
#######################################
import java.sql.*;
import java.util.Properties;
import java.io.InputStream;
import java.io.*;
import java.lang.*;
import com.sybase.jdbcx.*;
public class ConnectMe {
public static void main (String args[]) {
try{
//Class.forName("com.sybase.jdbc2.jdbc.SybDriver").newInstance();
Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
Connection con =
DriverManager.getConnection("jdbc:sybase://tkamdss01.fw.gs.com:5000/TKGSAMDV
01","sepacct_dev","sepacct_dev");
System.out.println("Connected.");
DatabaseMetaData dmd = con.getMetaData();
if (dmd == null) {
System.out.println ("No database meta data
available");
} else {
System.out.println ("Database Product Name : " +
dmd.getDatabaseProductName());
System.out.println ("Database Product Version: " +
dmd.getDatabaseProductVersion());
System.out.println ("Database Driver Name : " +
dmd.getDriverName());
System.out.println ("Database Driver Version : " +
dmd.getDriverVersion());
}
con.close();
}
catch(ClassNotFoundException cnfex) {
System.err.println( "Failed to load the JDBC Driver.");
cnfex.printStackTrace();
}
// catch(IllegalAccessException iaex) {
// System.err.println( "Access Illegal .");
// iaex.printStackTrace();
// }
// catch(InstantiationException insex) {
// System.err.println( "Failed to Instantiate.");
// insex.printStackTrace();
// }
catch(SQLException sqlex){
System.err.println("Unable to connect");
sqlex.printStackTrace();
}
}
}
#################### ERROR #################################
Exception in thread "main" java.lang.NoClassDefFoundError: ConnectMe
With regards,
Atchutarao Killamsetty,
Information Technology,
Goldman Sachs Asset Management Japan Limited.,
Tel:03-5573-7871
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html