Re: 3.1.6 Threading Bug/Issue
Posted by: Mark Matthews
Date: February 11, 2005 01:08PM

Jason Winnebeck wrote:
> I'm having a problem with the 3.1.6 driver. From
> what I understand of the JDBC specification is
> that all of the methods are supposed to be
> thread-safe. That means that while I'm executing
> a prepared statement, another thread could be
> executing or preparing another. I realize that
> MySQL driver is allowed to and does serialize
> requests to the driver, but this seems not to be
> the case. I have found a situtation where I am
> trying to execute a prepared statement and
> prepared one at the same time. It appears through
> my trace of the stacks that MySQL has sent
> conflicting commands to the DB. The result is a
> situation that appears like a deadlock
[snip]

Jason,

Known issue that's fixed for 3.1.7. You can test before official release with the latest nightly snapshot from http://downloads.mysql.com/snapshots.php#connector-j

Although I'd still advise you from using multiple threads against one connection, even though the JDBC spec requires a JDBC driver to be multi-thread safe, the very design of JDBC doesn't lend itself to being accessed in a multithreaded way (all of the statefull stuff surrounding open result sets and how they interact with statements, for example), and it doesn't get you any performance benefits, as pretty much all JDBC drivers have to serialize access to the database, so you're effectively single-threading portions of your multi-threaded application when you share the connection amongst threads.

-Mark

Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools
Oracle
http://www.mysql.com/products/enterprise/monitor.html

Options: ReplyQuote


Subject
Written By
Posted
February 11, 2005 11:24AM
Re: 3.1.6 Threading Bug/Issue
February 11, 2005 01:08PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.