Log in

No account? Create an account
27 June 2005 @ 11:13 pm
JDBC Best practices: 10 mistakes JDBC Programmers make.  

Either I am losing patience with humanity, or the panhandlers here are particularly numerous and aggressive. Also, it seems like somebody has told the local pimps and prostitutes that software developers are usually frustrated men with money to burn. They flock toward0anybody with a con badge or the uniform Grey Backpack.

raiseerror in stored procedure counts as an additional result. Execute() or executeUpdate() may not throw immediate exceptions.

ExecuteUpdate() and executeQuery() should not be called for stored procedures or anything else that can return multiple results.

Do not pass literal values into the stored procedure: will not work on some DBs, requires DB server to parse, prevents driver performance optimizations.

Measuring performance results without fetching columns is wonky, varies by DB and driver implementation.

Do not use string concatenation to make a statement. No statement cache, SQL injection problems.

Storing booleans in single-character fields MAY work. Type mismatch is ugly and unpredictable.

Pretty much all of these "unpredictable" problems are DB2 problems.

Batch processing when the statement is run many times in rapid succession.

I need to go. The Last Bus leaves soon.
Tags: ,