This post is for the book promotion for "Expert Oracle
JDBC Programming" by R. M. Menon. I hope it is suitable.
This may be a really basic set of questions to an expert but I haven't the vaguest idea of the answers so here goes.
I have started working on an application which will definitely be using multiple RDBMSs - MySQL, Derby, MSSQL, Oracle, other ... Only one will be used by each installation, but the DB can be chosen at install time (or perhaps even be switchable later - not sure of this yet).
What are the best design
patterns to use to ensure that a new database can be added to the code in the most a cost-effective and bug-minimising way? I was thinking of Strategy but I'm not sure that I am on the right track. I don't want to use lots of if/switch statements throughout the code.
Having read the post by George Stoianov on stored procedures, I would guess that in this case, stored procedures would not be suitable. However, I'm not in favour of sprinkling SQL statements all over my code. Does it make sense to name the queries and store them in some sort of Collection to be called up as the need arises? Should they be "prepared" in some way in advance of being used? I need a method that won't involve a slow startup of the application, so the "preparation" may have to take place before runtime.