This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple Database Connection. Best practice?

 
Lorenzo Tagliaferro
Greenhorn
Posts: 20
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic