|Subject:||Optional timeout for getConnection|
In many JDK versions, DriverManager.getConnection() is synchronized, which means only one thread at a time can get a database connection. This usually works fine, but it is possible to specify an invalid server name or address in the DBI URL, which causes DriverManager.getConnection() to try for a long time or potentially almost forever, causing other connection attempts to queue up. In particular, using an address of 0.0.0.0 seems to cause very long waits. (It's possible to deal with this at the perl level, but only if every perl script that uses this instance of DBD-JDBC is well behaved. It's not possible to prevent a rogue perl script from launching a denial of service attack using this method.) It would be nice to be able to specify a maximum amount of time to obtain a JDBC connection (e.g.: 10 seconds) and have DBD-JDBC give up and return an error if it takes longer than that.