Home:ALL Converter>Connecting to other database postgresql JDBC

Connecting to other database postgresql JDBC

Ask Time:2013-03-05T05:00:46         Author:pfulop

Json Formatter

I am working on program in Java that can connect to PostgreSQL multiple databases. Problem occurs when I want to reconnect to other database on the same server. I am using JDBC postgresql driver and whenever I try to close old connection and create new I get an exception:

org.postgresql.util.PSQLException: Something unusual has occured to cause the driver to fail. Please report this exception.

Is there any way to reconnect to other database?

Author:pfulop,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/15211038/connecting-to-other-database-postgresql-jdbc
duffymo :

I'd recommend creating the connection when you need it and closing it when you're done in the narrowest scope possible.\n\nI'd also advise you to set up connection pools, one for each database you might connect to.",
2013-03-04T21:03:09
yy