switch connection
In my class, I have static value Connection,
public static Connection con;
public static Connection getConnection(...) {
con = (Connection) DriverManager.getConnection(url, dbUser, dbPass);
return con;
}
Now I want to switch to another connection in an aother function, so I tried:
public static Connection switchConnection (...) {
con.close();
con = (Connection) DriverManager.getConnection(newUrl, newDbUser, newDbPass);
return con;
}
Is OK with this way.
Thanks

