| | |
| | | public void updateLocation(String device, String address, String mac, String lng, String lat) {
|
| | | Connection conn = null;
|
| | | String sql;
|
| | | String url = "jdbc:mysql://47.96.19.115:3306/monitor_db?characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC&user=root&password=xOlx8z9L7Pt6y9YI";
|
| | | String url = "jdbc:mysql://172.16.206.7:3306/monitor_db?characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC&user=root&password=xOlx8z9L7Pt6y9YI";
|
| | | try {
|
| | | Class.forName("com.mysql.jdbc.Driver");
|
| | | conn = DriverManager.getConnection(url);
|
| | | Statement stmt = conn.createStatement();
|
| | | sql = "UPDATE device SET `name`='" + device + "', address='" + address + "', longitude='" + lng + "', latitude='" + lat + "' WHERE mac='" + mac + "'";
|
| | | System.out.println(sql);
|
| | | int result = stmt.executeUpdate(sql);
|
| | | System.out.println("Update the location of the equipment: " + result);
|
| | | } catch (SQLException e) {
|