I've also downloaded the Sybase JDBC driver from SYBASE site and updated my
CLASSPATH to point to where the SYBASE JDBC driver was downloaded to.
I am running on Windows 95.
I wrote an APPLET that has a DataRetriever class that uses the Class.forName
method to instantiate the SybDriver class. Even though the SybDriver class
is recognized by the IDE (You can see it listed on the pull-down), at run
time the applet throws a class not found exception (ClassNotFoundException).
Does anyone have any idea?
The following is the DataRetriever class and its constructor:
****************************************************************************
***************
import com.sybase.jdbc.*;
import com.sybase.utils.Debug.*;
import java.util.*;
import java.sql.*;
public class DataRetriever
{
static Connection _con = null;
static Statement _stmt = null;
static ResultSet _rs = null;
static ResultSetMetaData _rsmd = null;
static String _user = "auser";
static String _password = "apwd";
static String _url = "jdbc:sybase:Tds:111.11.11.11:1111";
static Driver _driver = null;
static String _gateway = null;
static String _inputFile = null;
static String _commandTerminator = null;
static boolean _verbose = false;
static int status;
static int CONNECTED=1;
static int NOT_CONNECTED=0;
public DataRetriever()
{
try
{
DriverManager.registerDriver((Driver)
Class.forName("com.sybase.jdbc.SybDriver").newInstance());
}
catch (SQLException cnfe)
{
System.out.println("Unable to load the
Sybase JDBC driver. "
+ cnfe.toString());
cnfe.printStackTrace(System.out);
}
catch (ClassNotFoundException cnfe)
{
System.out.println("Could find Sybase Driver Class:
"+cnfe.toString());
}
catch (InstantiationException ie)
{
System.out.println("Could not instatiate the Sybase
Driver: "+ ie.toString());
}
catch (IllegalAccessException iae)
{
System.out.println("Could not access the Sybase
Driver: "+ iae.toString());
}
Properties props = new Properties();
props.put("user", this._user);
props.put("password", this._password);
try
{
this._driver = DriverManager.getDriver(_url);
//Connect using the Driver.connect()
this._con = _driver.connect(_url, props);
this._stmt = _con.createStatement();
this.status = this.CONNECTED;
}
catch (SQLException e)
{
this.status = this.NOT_CONNECTED;
System.out.println("Error Creating
Connection:"+e.getMessage());
}
}