Skip navigation links

MySQL Forums :: Connector/JDBC and Java :: Hwo thread-safe is mysql's jdbc driver?


Advanced Search

Re: Hwo thread-safe is mysql's jdbc driver?
Posted by: Mark Matthews ()
Date: September 04, 2007 06:29AM

Clemens,

While you _can_ share a connection across threads (especially if each thread has its own Statement), it's usually not a good idea. The JDBC API is not really designed to be used in a thread-safe way, and most JDBC connections (including MySQL's) can only process a single query at a time.

You'll be adding _more_ contention in your system rather than concurrency compared to just giving each thread a "private" connection.

-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
Hwo thread-safe is mysql's jdbc driver? Clemens Eisserer 09/03/2007 05:31AM
Re: Hwo thread-safe is mysql's jdbc driver? Mark Matthews 09/04/2007 06:29AM
Re: Hwo thread-safe is mysql's jdbc driver? Clemens Eisserer 09/04/2007 07:50AM


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.