I want to set jdbc connection lifetime and lifespan how do i do it.
I tried using properties.
Properties info = new properties();
info.put(user,"username");
info.put(password,"password");
info.put(connection lifetime, 0);
DriverManager.getConnection(server,info)
But this didn't work please help.
Try this:
info.setProperty(OracleConnection.CONNECTION_PROPERTY_THIN_NET_CONNECT_TIMEOUT, "2000");
Reference: Setting Network Timeout for JDBC connection
Note that not all JDBC JARs support setting a timeout this way. Sometimes you have to do it programatically.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.