In a desktop application with an embedded Derby database, what should I keep alive (as opposed to recreating each time when talking with the database) for the whole lifetime of the application?
ConnectionandStatement, using the same statement throughout the lifetime of the program?Connection, recreating statement repeatedly?- Neither of these. That is, recreating connection and statement repeatedly?
From a database amateur's viewpoint it would seem reasonable to avoid recreating anything that doesn't need to be recreated, but is option 1 (or 2) against standard practices or are there some obvious cons? Is (re)creating connections and statements expensive or not?