I was never sure what resources in JDBC must be explicitely closed and wasn’t able to find it anywhere explained. Finally my good colleague, Magne Mære, has explained it to me: In JDBC there are several kinds of resources that ideally should be closed after use. Even though every Statement and PreparedStatement is specified toContinue reading “JDBC: What resources you have to close and when?”
We all know that one coarse-grained operation is more efficient than a number of fine-grained ones when communicating over the network boundary but until recently I haven’t realized how big that difference may be. While performing a simple query individually for each input record proceeded with the speed of 11k records per hour, when IContinue reading “The power of batching or speeding JDBC by 100”
I hope everybody is enjoying the holiday and not spending hours on tech blogs and sites. At least I do 🙂 and thus this month’s list is a short one: Working With Static Imports in Eclipse – how to make working with static imports (nearly) as easy as with the normal ones (especially useful forContinue reading “Most interesting links of August”
This month about performance, the Java language and patterns, the development process, and a few interesting news.
In my java web application I use JDBC to store data in batches into a database. When there is a problem the whole batch insert fails and it’s difficult to find out what data caused it to fail. Therefore I’ve created a wrapper around PreparedStatement that remembers values passed into the various set* methods andContinue reading “A logging wrapper around PreparedStatement to provide detailed info upon error”
Often you need to insert a String from Java into a database column with a fixed length specified in bytes. Using string.substring(0, DB_FIELD_LENGTH); isn’t enough because it only cuts down the number of characters but in UTF-8 a single character may be represented by 1-4 bytes. But you cannot just turn the string into anContinue reading “Truncating UTF String to the given number of bytes while preserving its validity [for DB insert]”