package src;
import java.sql.DriverManager;
import com.mysql.jdbc.Connection;
public class Context {
private static Connection connS;
private static Connection connD;
private static final String SOURCE_URL = "jdbc:mysql://ldbdes1:3306/modus?user=maestro_adm&password=AdmMstr0";
private static final String DESTINATION_URL = "jdbc:mysql://ldbdes1:3306/maestro?user=maestro_adm&password=AdmMstr0";
//private static final String DESTINATION_URL = "jdbc:mysql://localhost:3306/maestro?user=root&password=280284";
public static Connection getSourceConnection() throws Exception {
if (connS == null || connS.isClosed()) {
connS = getConnection(SOURCE_URL);
}
return connS;
}
public static Connection getDestinationConnection() throws Exception {
if (connD == null || connD.isClosed()) {
connD = getConnection(DESTINATION_URL);
}
return connD;
}
private static Connection getConnection(String url) throws Exception {
Class.forName("com.mysql.jdbc.Driver");
Connection conn = (Connection) DriverManager
.getConnection(url);
return conn;
}
}