chunkII123
IS-IT--Management
I am currently looking for a way to force the connection to our new MySQL server to stay alive. It seems to have a five minute inactivity timeout, and I am looking for a way to force it to eith indefinitly auto-reconnect silently upon disconnection, or to permanently stay alive while it is not in use. Here is the code that I currently use to connect to our old server.
On a side note, the username, password, and actual database IP address is known, however, I blanked these fields out with *'s.
Beware of hackers bearing executables. Happy Hunting. 'irc.2600.net'
Code:
public Connection getConnection() {
try {
if (dbConnection == null || dbConnection.isClosed()) {
class.forName("com.mysql.jdbc.Driver");
url = "jdbc:mysql://******/mmimembersinfo";
userName = "*********";
password = "*********";
Connection con = DriverManager.getConnection(url, userName, password);
System.out.println("URL: " + url + "\nConnection: " + con);
dbConnection = con;
return con;
} else return dbConnection;
}catch( Exception exc ) {
exc.printStackTrace();
WarningMessage warning = new WarningMessage(true, "Error: " + CLASS_NAME + " " + exc.getMessage(), WarningMessage.CRITICAL_ERROR);
warning.setVisible(true);
return null;
}
}
On a side note, the username, password, and actual database IP address is known, however, I blanked these fields out with *'s.
Beware of hackers bearing executables. Happy Hunting. 'irc.2600.net'