Thread: Questions on property values
Hello, I've some small questions. We use the Postgres 8.0-311 JDBC 3 driver in a appülication to connect to a Postgres-DB-Server (Version(8.0)). The Target JDK is 1.4.2. We need in our case a reliable connection. In other words, if the connection is down, the JDBC driver should try to reconnect certain times without throwing exceptions. I looked via the DriverPropertyInfo[] method to all the available properties, but there seems to be no options like autoReconnect and maxReconnects as in the MySQL jbdc driver. Am i blind? Or is there another way to do this? Best Regards Carsten Marx -- University of Konstanz tel. 07531-88-2861 room: F401 mail: Carsten.Marx@uni-konstanz.de
When I have needed to do this I have used a dynamic proxy, using java.lang.reflect.Proxy, to extend Connection, Statement, and ResultSet. This does not solve the problem at the driver level, but it does allow you a lot of control to decide when and how often you re-try a query and when you need to re-open the connection. You can also make it very database independent. It does however incur some extra overhead. Craig
Carsten Marx wrote: > We need in our case a reliable connection. In other words, if the > connection is down, the JDBC driver should try to reconnect certain > times without throwing exceptions. The PostgreSQL driver doesn't provide this functionality. You could achieve something similar by wrapping the driver, perhaps.. but doesn't this belong in application logic? -O