6 messages in com.mysql.lists.javaRe: Reuse of PreparedStatement closes...
FromSent OnAttachments
Kevin Burton20 May 2004 18:20 
Mark Matthews20 May 2004 19:34 
Ben Dinnerville20 May 2004 19:39 
Kevin Burton21 May 2004 00:03 
Jeff Mathis21 May 2004 08:49 
Kevin Burton21 May 2004 09:32 
Subject:Re: Reuse of PreparedStatement closes ResultSet ...
From:Mark Matthews (ma@mysql.com)
Date:05/20/2004 07:34:43 PM
List:com.mysql.lists.java

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Kevin Burton wrote:

I'm running some performance testing on the MySQL JDBC driver's use of PreparedStatements...

If you cache the prepared statements on a per-connection basis I've noticed significant performance updates (20->30% in some cases)....

The problem I'm noticing is that in the 3.0.12 production driver the last ResultSet is closed the next time the PreparedStatement is executed.

This seems like a HUGE waste becuase ResultSet can stay open after a query has been executed (though I'm not 100% sure of this but pretty sure).

Are there any reasons why we can't just leave ResultSets open all the time thus increasing performance?

FYI I've even shutdown the DB connection (via an SSH tunnel) and the ResultSet still works fine in this situation.

This is because the JDBC spec requires that any open result sets are closed upon the next call to any of the execute() methods on the statement that created it (i.e. it's expected behavior, and required to be JDBC compliant).

-Mark

- -- Mr. Mark Matthews MySQL AB, Software Development Manager, J2EE and Windows Platforms Office: +1 708 332 0507 www.mysql.com

MySQL Guide to Lower TCO http://www.mysql.com/it-resources/white-papers/tco.php -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFArWrZtvXNTca6JD8RAq5RAJ4t5to1W0xI7XK2Yh2wGQKtMF9DCwCeLpID 7CKcDvqvQS9L8SvkuJL1t4A= =tUnL -----END PGP SIGNATURE-----