Accessing a local 7.3 database from within a java applet
Date: Fri, 14 Aug 1998 09:55:45 +0100
Message-ID: <35D3FB91.9142FA53_at_boyne.u-net.com>
When trying to run the applet (below) from within either Netscape or Internet Explorer, the applet runs but the database access fails raising the following exception:
Error: java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
I can however successfully run this as an application and using the appletviewer so it seems to be a problem with the browser configurations. Is their a "classpath" setting for the browser? Can someone please help?
import java.applet.Applet; import java.awt.Graphics; import java.sql.*; import java.math.*; import java.io.*; import java.util.*;
public class Welcome extends Applet {
// The driver to load
static final String driver_class = "oracle.jdbc.driver.OracleDriver";
// The connection to the database
Connection conn;
String output_text = "";
//Initialize the applet
public void init () {
try { xInit(); } catch (Exception e) { output_text = e.getMessage(); } finally { if (output_text == "") output_text = "Failure!"; }
}
//Component initialization
public void xInit() throws Exception {
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver ());
Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:_at_127.0.0.1:1521:orcl",
"griffj01", "griffj01");
// Query the employee names Statement stmt = conn.createStatement (); ResultSet rset = stmt.executeQuery ("select 'Welcome to '||valuefrom byn_system_parameters where name = 'COMPANY_NAME'");
while (rset.next ()) output_text = rset.getString (1);
}
public void paint (Graphics g) {
g.drawString ("Retrieving ...", 25, 25); g.drawString ("Result: " + output_text, 25, 40);
}
} Received on Fri Aug 14 1998 - 10:55:45 CEST