This discussion is archived
1 2 Previous Next 23 Replies Latest reply: Oct 15, 2001 12:21 PM by 807587 Go to original post RSS
  • 15. Re: Using Applets with JDBC
    807587 Newbie
    Currently Being Moderated
    Here's a new stack trace ... it is originating from the DriverManager.

    java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getConnection(
    at java.sql.DriverManager.getConnection(
    at DbaApplet.actionPerformed(
    at javax.swing.AbstractButton.fireActionPerformed(
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    at javax.swing.DefaultButtonModel.setPressed(
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
    at java.awt.Component.processMouseEvent(
    at java.awt.Component.processEvent(
    at java.awt.Container.processEvent(
    at java.awt.Component.dispatchEventImpl(
    at java.awt.Container.dispatchEventImpl(
    at java.awt.Component.dispatchEvent(
    at java.awt.LightweightDispatcher.retargetMouseEvent(
    at java.awt.LightweightDispatcher.processMouseEvent(

    at java.awt.LightweightDispatcher.dispatchEvent(
    at java.awt.Container.dispatchEventImpl(
    at java.awt.Component.dispatchEvent(
    at java.awt.EventQueue.dispatchEvent(
    at java.awt.EventDispatchThread.pumpOneEvent(
    at java.awt.EventDispatchThread.pumpEvents(
  • 16. Re: Using Applets with JDBC
    807587 Newbie
    Currently Being Moderated
    This is presumably because DriverManager doesn't have a Driver registered that understands the URL that you're passing to it.
    Are you using the same JDK for appletviewer and your application?
    Could you post the URL for db connection?
  • 17. Re: Using Applets with JDBC
    807587 Newbie
    Currently Being Moderated
    Thanks for the reply.

    Same JDK for both. URL is straightforward ... "jdbc:odbc:JavaTest".

  • 18. Re: Using Applets with JDBC
    807587 Newbie
    Currently Being Moderated
    This exception is being thrown when you do


    are you sure that no exception is being thron when you do

    DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());

  • 19. Re: Using Applets with JDBC
    807587 Newbie
    Currently Being Moderated
    If your code is finding a suitable driver as an application but isn't finding one as an applet, my guess would be that your classpath is somehow set differently when you're running the applet, and the directory with the JDBC drivers isn't included. I'm not sure how that would happen, but it's a thought.

  • 20. Re: Using Applets with JDBC
    807592 Newbie
    Currently Being Moderated
    Omer is right. If your planning on using JDBC through an Applet, imagine the Applet being executed and runned through that person's computer system and ask yourself a question.

    "Does he have the odbc on his computer system?"

    The answer of course would be no, and would only be yes to just the developer.

    My suggestion is that you look into something such as MySQL.

    Edited by: wlg on Aug 18, 2009 2:24 PM (removed name on request)
  • 21. Please Help Me
    807587 Newbie
    Currently Being Moderated
    I am trying to access the database located on the intranet thru an applet. I geta class not found exception and a driver not found error. Here is the stack trace
    java.lang.ClassNotFoundException: C:\jdk1.3\bin\Map\oracle\jdbc\driver\OracleDriver.class (The system cannot find the path specified)
    at Method)
    at sun.applet.AppletClassLoader.getBytes(
    at sun.applet.AppletClassLoader.access$100(
    at sun.applet.AppletClassLoader$
    at Method)
    at sun.applet.AppletClassLoader.findClass(
    at java.lang.ClassLoader.loadClass(
    at sun.applet.AppletClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    at java.lang.ClassLoader.loadClassInternal(
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(
    at frame.action(
    at java.awt.Component.handleEvent(
    at java.awt.Component.postEvent(
    at java.awt.Component.postEvent(
    at java.awt.Component.postEvent(
    at java.awt.Component.dispatchEventImpl(
    at java.awt.Component.dispatchEvent(
    at java.awt.EventQueue.dispatchEvent(
    at java.awt.EventDispatchThread.pumpOneEvent(
    at java.awt.EventDispatchThread.pumpEvents(

    I get the SQL exception as soonas i try to connect to the database. here is the code i tried .

    import java.awt.*;
    import java.util.*;
    import java.sql.*;
    import java.applet.Applet;
    import javax.swing.*;

    public class frame extends java.applet.Applet
    // The JDBC driver to load

    //Syntax for driver class
    //driver for Java1.0: "dnlddriver"
    //driver for Java1.1: "driver"
    static final String driver_class ="oracle.jdbc.driver.OracleDriver";

    // The connect string please change the Username, Password and database
    // information. Syntax for the ORACLE driver:
    // "jdbc:oracle:<driver>:<USERNAME>/<PASSWORD>@
    // <IP-Address of DB Server>:<Port>:<SID>"
    // Connection paramters to connect to the local database at the 15. faculty:
    // IP :
    // Port : 1521
    // SID : test
    // driver for Java1.0: dnldthin
    // driver for Java1.1: thin
    static final String connect_string =

    // The SQL query string
    static final String query ="select x,y from requests";

    // The button to push for executing the query
    Button execute_button;

    // The place where to dump the query result
    static TextArea output;

    // The connection to the database
    Connection conn;

    // **************************************************************************
    // init                                                                   
    // Create the simple user interface during the initialization of the applet
    // **************************************************************************
    public void init ()
    this.setLayout (new BorderLayout ());
    Panel p = new Panel ();
    p.setLayout (new FlowLayout (FlowLayout.LEFT));
    // Change the name for the button
    execute_button = new Button ("Klick me");
    p.add (execute_button);
    this.add ("North", p);
    output = new TextArea (10, 60);
    this.add ("Center", output);

    // **********************************
    // * action *
    // * If the User presses the button *
    // **********************************
    public boolean action (Event ev, Object arg)

    if ( == execute_button)
    output.appendText ("Start.\n");

    // Load the JDBC driver
    output.appendText ("Loading JDBC driver " + driver_class + "\n");
              Class.forName ("oracle.jdbc.driver.OracleDriver");
              }catch (Exception ee){
                   output.appendText("Am Again Stuck"+ee.getMessage());     
              output.appendText ("Loaded the driver " + driver_class + "\n");

    // Connect to the databse
    output.appendText ("Connecting to " + connect_string + "\n");
    conn = DriverManager.getConnection (connect_string);
    output.appendText ("Connected\n");

    // Create a statement
    Statement stmt = conn.createStatement ();

    // Execute the query
    output.appendText ("Executing query " + query + "\n");
    ResultSet rset = stmt.executeQuery (query);

    // Write the result set
    // dispResult(rset);


    // Write the final text
    output.appendText ("done.\n");

    // Close the connection to the database and clean up memory
    // Catch the SQL errors
    catch (SQLException e) {
    // Write the SQL Exceptions if they occurs.
    // Note some backends return a row of error messages
    output.appendText("\n"+"**** SQL Exception caught ****"+"\n");
    while (e != null) {
    output.appendText ("SQL State :" + e.getSQLState() +"\n");
    output.appendText ("Message :" + e.getMessage());
    output.appendText ("Vendor Error Code:" + e.getErrorCode() +"\n");

    // Goto next exception
    e = e.getNextException ();
    // Catch the other Java errors
    catch (java.lang.Exception e) {
    // Write the error message if it excist
    output.appendText ("Am Stuck Here " e.getMessage () "\n");
    // Quit the procedure
    return true;
    return false;

    Please help me with this i am stuck at this point
  • 22. Re: Using Applets with JDBC
    807587 Newbie
    Currently Being Moderated
    I appreciate the feedback ...

    I would agree 100% if we were deploying to a loarge number of users, but we aren't. Nor is this application being used on the Internet. I just go to the user's PC and set up the ODBC Data Source ... or is there more to it that I'm just not getting?

    Why would I spend $$ on native JDBC for SQLServer when I have JDBC:ODBC for free? Unless, of course, the ODBC didn't work.

  • 23. Re: Using Applets with JDBC
    807587 Newbie
    Currently Being Moderated
    I have been trying similar program (access an Access97 database thru JDBC-ODBC from an applet in appletviewer). I find that the applet works when I create an all-permissions-granted policy. When I limit policy to grant runtime permission to accessClassInPackage.sun.jdbc.odbc, I get the driver not found message. It seems to me that some permission is missing.

    Hope to learn more thru this discussion thread...
1 2 Previous Next