Hi folks,
I'm using the 3.07 release with mysql 4.04. All our tables are InnoDB
tables. The API has a class per table, with several classes sharing
inheritance heirarchies as appropriate. I've got a central DBStore class
that everything goes through for queries. I have my own set of
"Attribute" classes, LongAttr, IntAttr, DateAttr, etc, that everything
coming from the database becomes rather than using java.sql objects or
primitives. These classes take care of formatting themselves for
queries, using or not using quotes when necessary, etc. When loading
from a resultset, I always call the appropriate getXXX method with a
column index.
For everything I do, I create a statement from my connection, issue the
query, look at the result set, then close the statement. Because mysql
does not "compile" sql and cache it, I have been of the opinion that it
is not necessary to create prepared statements. In contrast, with an
Oracle database, use of PreparedStatements is almost required.
The question is, would using PreparedStatements speed things up? I don't
think I'm suffering from any performance hit now. About the only thing
I've noticed is when tables get a lot of columns (~80 or so), setting
all the attributes seems to be slower. But, programmatically, is it
wrong to do things as I've indicated?
always looking for improvements ...
jeff
--
Jeff Mathis, Ph.D. 505-955-1434
The Prediction Company jmathis@stripped
525 Camino de los Marquez, Ste 6 http://www.predict.com
Santa Fe, NM 87505