[Dev-sig] FW: Java question

Emerson, Tom Tom.Emerson at wbconsultant.com
Thu Oct 26 13:14:28 PDT 2006


[redirected to Devsig]

-----Original Message----- Of Jana Lingo

On a more advanced note:
I'm working on a project on my own to get my Java skills beyond the
"hello world" stage. This has a DBMS component. My question is should I
embed the SQL stuff in the object classes or segregate them into a
Database object? I'm leaning towards the latter. Jana
==========================

I would wrap the database calls in some form of object -- "SQL", as
universal as it may seem, still has some "quirks" between database
engines.  There will come a day when "the database" changes (say from
mysql to postgresql, or even oracle 8i to oracle 9i...) and you'll find
that some syntax somewhere has to be changed.  Which would you rather
do: fix one component or repeatedly fix the same line of code everywhere
it occurs?

You may also find (at some point) that using a database for one or more
tables is overkill (maybe a flat file will do, or if only used for
temporary stuff, kept in memory)  by wrapping the DB calls into an
object, you can change that object to use "something else" without
redesigning your entire program...



More information about the Dev-sig mailing list