|
|
|
@ -2,6 +2,9 @@ package sh.adb.sensorCommunityAPI;
|
|
|
|
|
|
|
|
|
|
import org.json.simple.JSONObject;
|
|
|
|
|
|
|
|
|
|
import java.sql.Connection;
|
|
|
|
|
import java.sql.DriverManager;
|
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
|
|
|
|
|
public class dbHandler {
|
|
|
|
|
String pw;
|
|
|
|
@ -9,12 +12,16 @@ public class dbHandler {
|
|
|
|
|
String user;
|
|
|
|
|
int port;
|
|
|
|
|
String server;
|
|
|
|
|
Connection connection;
|
|
|
|
|
|
|
|
|
|
dbHandler(JSONObject config){
|
|
|
|
|
dbHandler(JSONObject config) throws SQLException {
|
|
|
|
|
this.pw = (String) config.get("pw");
|
|
|
|
|
this.db = (String) config.get("db");
|
|
|
|
|
this.user = (String) config.get("user");
|
|
|
|
|
this.port = (Integer) config.get("port");
|
|
|
|
|
this.server = (String) config.get("server");
|
|
|
|
|
Connection connection = DriverManager.getConnection(
|
|
|
|
|
"jdbc:mariadb://"+this.server+":"+this.port+"/"+this.db+"?user="+this.user+"&password="+this.pw
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|