Following up on @Sjoerd's answer:
Any tools or open source libs that can be helpful?
Hibernate or some other JPA implementation is your best bet.
Alternatively, Spring has some JDBC support classes that do some of the work ... if you can figure out which of the various alternatives is a good match to your requirements.
Unfortunately, implementing an application that works against multiple database backends is hard work, no matter how you do it. In my experience, you usually end up with a solution that doesn't perform as well as a solution that is tailored to one and only one database back end.
If I had my way, database vendors who refuse to implement the SQL standard would be first against the wall ... come the revolution.