Beispiel #1
0
 public static ResultSet query(String query) {
   try {
     Class.forName(JDBC_DRIVER).newInstance();
     Connection con = DriverManager.getConnection(DB_URL, USER, PASS);
     Statement statement = con.createStatement();
     return statement.executeQuery(query);
   } catch (Exception e) {
     Logger.log(e, "Database:query");
   }
   return null;
 }
Beispiel #2
0
 public static boolean update(String query) {
   try {
     Class.forName(JDBC_DRIVER).newInstance();
     Connection con = DriverManager.getConnection(DB_URL, USER, PASS);
     Statement statement = con.createStatement();
     if (statement.executeUpdate(query) > 0) {
       return true;
     } else {
       return false;
     }
   } catch (Exception e) {
     Logger.log(e, "Database:update");
   }
   return false;
 }