Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4241408

Plug-In fails to load sun.jdbc.odbc.JdbcOdbcDriver

XMLWordPrintable

    • x86
    • windows_nt

      The following applet is unable to load sun.jdbc.odbc.JdbcOdbcDriver
      via Class.forName with Java Plug-In 1.2.1. This code works properly
      when loaded with the 1.1 JVM, and works intermittently with the appletviewer from JDK 1.2.1.

      //import java.applet.Applet;
      import javax.swing.*;
      import java.awt.*;
          

      public class driver extends JApplet {
          public void init() {
      getContentPane().setLayout(null);
      setSize(426,266);

      String driverClass = "sun.jdbc.odbc.JdbcOdbcDriver";
              try {
                  Class.forName(driverClass).newInstance();
                  System.out.println("Class " + driverClass + " was found OK");
      } catch( Exception e) {
                  System.out.println("Class " + driverClass + " was not found");
      }

      driverClass = "javax.swing.JApplet";
      try {
                  Class.forName(driverClass).newInstance();
                  System.out.println("Class " + driverClass + " was found OK");
      } catch( Exception e) {
                  System.out.println("Class " + driverClass + " was not found");
      }
          }
      }

      Output when the applet fails:

      % appletviewer driver-noplugin.html
      Class sun.jdbc.odbc.JdbcOdbcDriver was not found
      Class javax.swing.JApplet was found OK
      %

      Expected output:
      % appletviewer driver-noplugin.html
      Class sun.jdbc.odbc.JdbcOdbcDriver was found OK
      Class javax.swing.JApplet was found OK
      %

            duke J. Duke
            mhmccart Mary Mccarthy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: