2019-10-03 08:42:09 +02:00
|
|
|
package com.wasteinformationserver.db;
|
2019-09-20 15:02:17 +02:00
|
|
|
|
|
|
|
import java.sql.Connection;
|
|
|
|
import java.sql.DriverManager;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
|
|
|
public class MySQLConnector extends Database {
|
|
|
|
|
|
|
|
static {
|
|
|
|
try {
|
|
|
|
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public MySQLConnector(String user, String password, String host, int port, String dbName) {
|
|
|
|
super(user, password, host, port, dbName);
|
|
|
|
}
|
|
|
|
|
2019-10-03 08:42:09 +02:00
|
|
|
public Connection getConnection() throws SQLException {
|
|
|
|
return DriverManager.getConnection(
|
2019-09-20 15:02:17 +02:00
|
|
|
"jdbc:mysql://" + host + ":" + port + "/" + dbName + "?useSSL=false",
|
|
|
|
user,
|
|
|
|
password);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|