Java Reference
In-Depth Information
compile the statement once and then place it in a cache that
will be reused not just later in the same method where the
PreparedStatement is created, but across all points in your
program where the same SQL code is used in the same or
another PreparedStatement. Saving this re-compilation step
can result in a significantly lower number of calls to the
JDBC driver and improve the performance of your
application. You don't have to do anything special to take
advantage of this; just write your JDBC code to use
PreparedStatements. By writing your code to use a
PreparedStatement instead of a regular JDBC Statement class
(which uses purely dynamic SQL) you can take advantage of
this
performance
enhancement
while
not
losing
any
portability.
One more important area that we see ignored far too often is
clustering. Applications need to be designed and delivered to
run in a clustered environment. Most realistic environments
require clustering for scalability and reliability. Applications
that don't cluster lead quickly to disaster.
Log
your
program
state
using
a
standard
logging
framework
This includes exception handlers. Use a logging framework
like JDK 1.4 or above logging or Log4J.
Logging is sometimes the most tedious, undervalued part of
programming, but it is the difference between long hours of
debugging and going home at a reasonable time. As a general
rule of thumb, at every transition point, log it. When you're
passing parameters from one method to another method, or
Search WWH ::




Custom Search