For an example of this check out the Mach-ii.info sample application.  
(http://mach-ii.info/index.cfm?event=resources#code) It implements the Abstract 
Factory pattern as described here 
http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
Using the same architecture my bug tracking app, tracking-tools.com, supports 
MSSQL, MySQL, Oracle and Derby.

hth,
Phil

>Your best bet is to encapsulate all your SQL into a collection of
>DAOs, and have one collection for each target database.  Then you have
>a configuration parameter that says which DB you're using, and your
>code then uses the appropriate collection of DAOs to do the data
>access.
>
>That might seem like you'll need to write every query X times, where X
>is the number of target databases.  For some queries, that's true, but
>for a lot of them, standard SQL will work.  So create an abstract
>version of each DAO that has general query implementations in them,
>and then only override the ones you need to in your db-specific DAOs. 
>It's a little more complex to implement, but it'll make you job a lot
>easier down the road.
>
>cheers,
>barneyb
>
>On Apr 11, 2005 1:07 PM, jonese <[EMAIL PROTECTED]> wrote:
>
>-- 
>Barney Boisvert
>[EMAIL PROTECTED]
>360.319.6145
>http://www.barneyb.com/
>
>Got Gmail? I have 50 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:202381
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to