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

Accessing Access database via JDBC-ODBC bridge

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P5
    • Resolution: Future Project
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0"
      Java(TM) SE Runtime Environment (build 1.6.0-b105)
      Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

      FULL OS VERSION :
      Microsoft Windows XP Professional Version 2002 Service Pack 2

      A DESCRIPTION OF THE PROBLEM :
      I have a class for querying an MS Access database. The database is queryied every one second in a separarate thread, when the user clicks on the "start" button. The program crashes when I call the query method from the run() or the action handler. In other cases works fine.

      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      #
      # An unexpected error has been detected by Java Runtime Environment:
      #
      # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c911010, pid=3176, tid=1080
      #
      # Java VM: Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode, sharing)
      # Problematic frame:
      # C [ntdll.dll+0x1010]
      #
      # If you would like to submit a bug report, please visit:
      # http://java.sun.com/webapps/bugreport/crash.jsp
      #

      --------------- T H R E A D ---------------

      Current thread (0x07f93c00): JavaThread "Thread-2" [_thread_in_native, id=1080]

      siginfo: ExceptionCode=0xc0000005, reading address 0x00000018

      Registers:
      EAX=0x00000004, EBX=0x269b4e60, ECX=0x7ffd4000, EDX=0x00000004
      ESP=0x0301f908, EBP=0x0301f920, ESI=0x00000000, EDI=0x02e11348
      EIP=0x7c911010, EFLAGS=0x00010246

        Top of Stack: (sp=0x0301f908)
      0x0301f908: 74605a16 00000004 02e1136c 745d139f
      0x0301f918: 02e1136c 02e11348 0301f930 745d2c5d
      0x0301f928: 02e1136c 07f93ce8 0301f944 745d5fa0
      0x0301f938: 02e11348 74600000 00000001 0301f960
      0x0301f948: 745d740e 02e11348 0301f980 00000003
      0x0301f958: 07f91ff8 07f93ce8 0301f978 6d3f124e
      0x0301f968: 02e11348 0301f980 07f93c00 269b4e60
      0x0301f978: 0301f9bc 0091a430 00000000 0301f9d8

      Instructions: (pc=0x7c911010)
      0x7c911000: 90 90 90 90 90 64 8b 0d 18 00 00 00 8b 54 24 04
      0x7c911010: 83 7a 14 00 75 4f f0 ff 42 04 75 19 8b 41 24 89


      Stack: [0x02fd0000,0x03020000), sp=0x0301f908, free space=318k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      C [ntdll.dll+0x1010]
      C [ODBC32.dll+0x2c5d]
      C [ODBC32.dll+0x5fa0]
      C [ODBC32.dll+0x740e]
      C [JdbcOdbc.dll+0x124e]
      j sun.jdbc.odbc.JdbcOdbc.allocStmt(J[B)J+0
      j sun.jdbc.odbc.JdbcOdbc.SQLAllocStmt(J)J+47
      j sun.jdbc.odbc.JdbcOdbcConnection.createStatement(II)Ljava/sql/Statement;+27
      j sun.jdbc.odbc.JdbcOdbcConnection.createStatement()Ljava/sql/Statement;+7
      j Log.getErrorStatus()I+6
      j ThreadApp.run()V+30
      j java.lang.Thread.run()V+11
      v ~StubRoutines::call_stub

      Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
      j sun.jdbc.odbc.JdbcOdbc.allocStmt(J[B)J+0
      j sun.jdbc.odbc.JdbcOdbc.SQLAllocStmt(J)J+47
      j sun.jdbc.odbc.JdbcOdbcConnection.createStatement(II)Ljava/sql/Statement;+27
      j sun.jdbc.odbc.JdbcOdbcConnection.createStatement()Ljava/sql/Statement;+7
      j Log.getErrorStatus()I+6
      j ThreadApp.run()V+30
      j java.lang.Thread.run()V+11
      v ~StubRoutines::call_stub

      --------------- P R O C E S S ---------------

      Java Threads: ( => current thread )
      =>0x07f93c00 JavaThread "Thread-2" [_thread_in_native, id=1080]
        0x00296000 JavaThread "DestroyJavaVM" [_thread_blocked, id=2340]
        0x02b18800 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=4056]
        0x02b10800 JavaThread "AWT-Windows" daemon [_thread_in_native, id=2624]
        0x02b0fc00 JavaThread "AWT-Shutdown" [_thread_blocked, id=2648]
        0x02b0d400 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=2444]
        0x02a5cc00 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=4020]
        0x02a57c00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3136]
        0x02a56800 JavaThread "Attach Listener" daemon [_thread_blocked, id=1624]
        0x02a55c00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2744]
        0x02a51400 JavaThread "Finalizer" daemon [_thread_blocked, id=1644]
        0x02a4d000 JavaThread "Reference Handler" daemon [_thread_blocked, id=632]

      Other Threads:
        0x02a43c00 VMThread [id=944]
        0x02a77400 WatcherThread [id=2260]

      VM state:not at safepoint (normal execution)

      VM Mutex/Monitor currently owned by a thread: None

      Heap
       def new generation total 960K, used 292K [0x22990000, 0x22a90000, 0x22e70000)
        eden space 896K, 25% used [0x22990000, 0x229c91d8, 0x22a70000)
        from space 64K, 100% used [0x22a80000, 0x22a90000, 0x22a90000)
        to space 64K, 0% used [0x22a70000, 0x22a70000, 0x22a80000)
       tenured generation total 4096K, used 341K [0x22e70000, 0x23270000, 0x26990000)
         the space 4096K, 8% used [0x22e70000, 0x22ec5770, 0x22ec5800, 0x23270000)
       compacting perm gen total 12288K, used 607K [0x26990000, 0x27590000, 0x2a990000)
         the space 12288K, 4% used [0x26990000, 0x26a27d10, 0x26a27e00, 0x27590000)
          ro space 8192K, 62% used [0x2a990000, 0x2ae8b9c8, 0x2ae8ba00, 0x2b190000)
          rw space 12288K, 52% used [0x2b190000, 0x2b7ce348, 0x2b7ce400, 0x2bd90000)

      Dynamic libraries:
      0x00400000 - 0x00423000 C:\WINXP\system32\java.exe
      0x7c910000 - 0x7c9c7000 C:\WINXP\system32\ntdll.dll
      0x7c800000 - 0x7c906000 C:\WINXP\system32\kernel32.dll
      0x77da0000 - 0x77e4a000 C:\WINXP\system32\ADVAPI32.dll
      0x77e50000 - 0x77ee1000 C:\WINXP\system32\RPCRT4.dll
      0x7c340000 - 0x7c396000 C:\Programme\Java\jre1.6.0\bin\msvcr71.dll
      0x6d7c0000 - 0x6da07000 C:\Programme\Java\jre1.6.0\bin\client\jvm.dll
      0x77d10000 - 0x77da0000 C:\WINXP\system32\USER32.dll
      0x77ef0000 - 0x77f37000 C:\WINXP\system32\GDI32.dll
      0x76af0000 - 0x76b1e000 C:\WINXP\system32\WINMM.dll
      0x76330000 - 0x7634d000 C:\WINXP\system32\IMM32.DLL
      0x6d310000 - 0x6d318000 C:\Programme\Java\jre1.6.0\bin\hpi.dll
      0x76bb0000 - 0x76bbb000 C:\WINXP\system32\PSAPI.DLL
      0x6d770000 - 0x6d77c000 C:\Programme\Java\jre1.6.0\bin\verify.dll
      0x6d3b0000 - 0x6d3cf000 C:\Programme\Java\jre1.6.0\bin\java.dll
      0x6d7b0000 - 0x6d7bf000 C:\Programme\Java\jre1.6.0\bin\zip.dll
      0x6d000000 - 0x6d1c3000 C:\Programme\Java\jre1.6.0\bin\awt.dll
      0x72f70000 - 0x72f96000 C:\WINXP\system32\WINSPOOL.DRV
      0x77be0000 - 0x77c38000 C:\WINXP\system32\msvcrt.dll
      0x774b0000 - 0x775ed000 C:\WINXP\system32\ole32.dll
      0x6d3f0000 - 0x6d3fd000 C:\Programme\Java\jre1.6.0\bin\JdbcOdbc.dll
      0x745d0000 - 0x7460d000 C:\WINXP\system32\ODBC32.dll
      0x5d450000 - 0x5d4ea000 C:\WINXP\system32\COMCTL32.dll
      0x7c9d0000 - 0x7d1ef000 C:\WINXP\system32\SHELL32.dll
      0x77f40000 - 0x77fb6000 C:\WINXP\system32\SHLWAPI.dll
      0x76350000 - 0x7639a000 C:\WINXP\system32\comdlg32.dll
      0x773a0000 - 0x774a3000 C:\WINXP\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll
      0x20000000 - 0x20019000 C:\WINXP\system32\odbcint.dll
      0x77fc0000 - 0x77fd1000 C:\WINXP\system32\Secur32.dll
      0x5b0f0000 - 0x5b128000 C:\WINXP\system32\uxtheme.dll
      0x736d0000 - 0x73719000 C:\WINXP\system32\ddraw.dll
      0x73b30000 - 0x73b36000 C:\WINXP\system32\DCIMAN32.dll
      0x6d2b0000 - 0x6d303000 C:\Programme\Java\jre1.6.0\bin\fontmanager.dll
      0x746a0000 - 0x746eb000 C:\WINXP\system32\MSCTF.dll
      0x75250000 - 0x7527e000 C:\WINXP\system32\msctfime.ime
      0x6d570000 - 0x6d583000 C:\Programme\Java\jre1.6.0\bin\net.dll
      0x71a10000 - 0x71a27000 C:\WINXP\system32\WS2_32.dll
      0x71a00000 - 0x71a08000 C:\WINXP\system32\WS2HELP.dll
      0x6d590000 - 0x6d599000 C:\Programme\Java\jre1.6.0\bin\nio.dll

      VM Arguments:
      java_command: ThreadApp
      Launcher Type: SUN_STANDARD

      Environment Variables:
      PATH=x:\cPerl\bin;C:\Programme\ActiveState Komodo 3.5\;C:\WINXP\system32;C:\WINXP\HPC\CAPM;C:\WINXP;C:\WINXP\system32\Wbem;C:\WINXP\Tools;C:\Programme\Microsoft SQL Server\80\Tools\Binn\;C:\PROGRA~1\CA\SHARED~1\SCANEN~1;C:\PROGRA~1\CA\ETRUST~1;C:\Programme\Winzip\;C:\Programme\UltraEdit;C:\Programme\PerlIDE\;C:\Programme\Java\jdk1.6.0\bin;C:\Programme\CVSNTUSERNAME=N535835
      OS=Windows_NT
      PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 1, GenuineIntel



      --------------- S Y S T E M ---------------

      OS: Windows XP Build 2600 Service Pack 2

      CPU:total 1 family 15, cmov, cx8, fxsr, mmx, sse, sse2

      Memory: 4k page, physical 1038832k(327720k free), swap 1717436k(998512k free)

      vm_info: Java HotSpot(TM) Client VM (1.6.0-b105) for windows-x86, built on Nov 29 2006 00:48:48 by "java_re" with unknown MS VC++:1310



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      The main program:
      ================

      import java.awt.event.*;
      import java.awt.*;
      import javax.swing.*;

      class ThreadApp extends JFrame implements ActionListener, Runnable{
          JButton startButton = new JButton("Start");
          JButton stopButton = new JButton("Stop");
          JPanel mainPanel = new JPanel();

          private Thread runner;
          private boolean stopThread;

          Log log;

          public ThreadApp( Log log )
          {
              super("Thread App");

              this.log = log;


              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setBounds(300, 300, 150, 65);
              setResizable( false );

              startButton.addActionListener( this );
              stopButton.addActionListener( this );
              stopButton.setEnabled( false );

              mainPanel.add( startButton );
              mainPanel.add( stopButton );
              add( mainPanel );

              setVisible(true);
          }


          public void actionPerformed(ActionEvent evt)
          {
              Object source = evt.getSource();

              if ( source == startButton ) {
                  startButton.setEnabled( false );
                  stopButton.setEnabled( true );

                  runner = new Thread( this );
                  runner.start();

              } else if ( source == stopButton ) {
                  stopButton.setEnabled( false );
                  startButton.setEnabled( true );
                  stopThread = true;
              }
          }

          public void run(){
              int timeCounter = 0;
              int errorStatus = 0;

              stopThread = false;

              while ( !stopThread && errorStatus == 0 ) {
                  try{

                      Thread.sleep( 1000 );
                      errorStatus = log.getErrorStatus();

                  } catch (InterruptedException ie) {
                      // do nothing
                  }
              }

              if ( errorStatus != 0 ) {
                  JOptionPane.showMessageDialog( this,
                                                "Hiba!",
                                                "ThreadApp",
                                                JOptionPane.ERROR_MESSAGE
                                               );
              }

              stopThread = false;
          }

          public static void main(String[] arguments)
          {
             Log log = new Log();
             ThreadApp tanulo = new ThreadApp( log );
             log.done();
          }
      }



      The class for accessing the database:
      ==============================

      import java.sql.*;

      public class Log
      {
          Connection conn;

          public Log() {
              try {
                 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                 conn = DriverManager.getConnection( "jdbc:odbc:Log", "", "");
              } catch ( ClassNotFoundException s ) {
                     System.out.println( "Class not found: " + s.toString() );
              } catch ( SQLException s ){
                     System.out.println( "SQL Error: " + s.toString() + " "
                                         + s.getErrorCode() + " " + s.getSQLState());
              }
          }

          public int getErrorStatus() {
             int status = 1;

             try {
                Statement st = conn.createStatement();
                System.out.println( "eddig" );
                ResultSet rec = st.executeQuery( "SELECT error FROM log" );
                while ( rec.next() ){
                    status = rec.getInt( 1 );
                }
             } catch (SQLException s) {
                   System.out.println( "SQL Error: "
                                       + s.toString()
                                       + " "
                                       + s.getErrorCode() + " " + s.getSQLState());
             }

             return status;
          }

          public void done() {
              try {
                  conn.close();
              } catch ( SQLException s ){
                  System.out.println( "SQL Error: " + s.toString() + " "
                                      + s.getErrorCode() + " " + s.getSQLState());
              }
          }

      /* public static void main( String[] args ) {
              Log log = new Log();
              System.out.println( log.getErrorStatus() );
              log.done();
          } */

      }


      ---------- END SOURCE ----------

        Attachments

          Activity

            People

            Assignee:
            lancea Lance Andersen
            Reporter:
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: