next up previous
Next: Safe configuration and its Up: Implementation Previous: Problems encountered during performace

Code and application environment optimization

Sometimes it is more convenient or more efficient to use a PreparedStatement for sending SQL statements to the database. In jdbdump we use PreparedStatements because we deal with many tables and data. The main feature of a PreparedStatement is that it is given an SQL statement when it is created. The advantage to this is that in most cases, this SQL statement will be sent to the DBMS right away, where it will be compiled. As a result, the PreparedStatement object contains not just an SQL statement, but an SQL statement that has been precompiled. This means that when the prepared statement is executed, the DBMS can just run the prepared statement's SQL statement without having to compile it first. This speeds up the dump / restore process.
Currently we use PreparedStatement in the process of uploading records of data from one table during the execution of DatabaseConnector.restore(). An insert statement is prepared each time a new table has to be filled with data, and then the same statement is executed once for each record of data.


next up previous
Next: Safe configuration and its Up: Implementation Previous: Problems encountered during performace
Wiktor Kolodziej 2006-01-12