aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Multiple Database Connection. Best practice? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Multiple Database Connection. Best practice?" Watch "Multiple Database Connection. Best practice?" New topic
Author

Multiple Database Connection. Best practice?

Lorenzo Tagliaferro
Greenhorn

Joined: Jun 15, 2009
Posts: 20

Hi everyone!!

I'm trying to create a simple stand-alone project (no web-app), where there are 2 kinds of Database (MySQL, Postgres).

I would like to know, what is the best practice to create a class or a method that store the drives and istantiate the connection with differente databases.

This is, what I have created:



Thank in advance!!
Hongli Li
Ranch Hand

Joined: Oct 29, 2006
Posts: 124
you can create two property files one for mysql and the other for postgres, so you can selectively load the properties by a flag. I would use spring to manage database access.


Do you know why this cup is useful? Because it is empty.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple Database Connection. Best practice?