FIX: Thread Blocking Issues When Using JDBC-ODBC Bridge (191932)
The information in this article applies to:
- Microsoft SDK for Java 1.0
- Microsoft SDK for Java 1.5
- Microsoft SDK for Java 1.51
- Microsoft SDK for Java 2.0
- Microsoft SDK for Java 3.0
- Microsoft SDK for Java 2.01
- Microsoft SDK for Java 2.02
This article was previously published under Q191932 SYMPTOMS When using the Microsoft supplied JDBC-ODBC Bridge
component for JDBC (Msjdbc10.dll and associated Java class files) with multiple
threads in a Java application or applet, the threads using JDBC appear to hang.
Running a JDBC statement on more than one thread results in thread blocking,
even when using a thread safe non-blocking ODBC driver such as the Microsoft
SQL Server ODBC driver. CAUSE The Microsoft JDBC-ODBC Bridge globally synchronizes all
method calls. This means that a call to any JDBC method that does not
immediately return will block all other JDBC calls from other threads. If your
JDBC code calls executeQuery for example, and the query takes five seconds to
run, then all other JDBC using threads in your application will hang for five
seconds.
This can easily cause a deadlock when one JDBC using thread
has locked a table and another JDBC using thread tries to lock the same table.
Because the second thread is blocked by the first threads table lock, the
second thread waits inside the JDBC call to lock the table -- therefore
preventing the first thread from making the necessary JDBC calls to unlock the
table. RESOLUTION Update your virtual machine to the latest version.
STATUS Microsoft has confirmed this to be a bug in the Microsoft
products listed at the beginning of this article. This bug has been corrected
in the Virtual Machine that is included with SDK for Java 3.1. REFERENCES For the latest Knowledge Base articles and other support
information about Visual J++ and the SDK for Java, see the following pages on
the Microsoft Technical Support site: For more information about Virtual Machine for Java and SDK for
Java, visit the following Microsoft Web site:
Modification Type: | Minor | Last Reviewed: | 11/17/2005 |
---|
Keywords: | kbbug kbfix kbJava kbprb KB191932 |
---|
|