Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void connectMYSQL() {
- try {
- System.out.println("[PixelMV] Verbindung zur Datenbank wird hergestellt!");
- conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/testdb?" + "user=testuser");
- System.out.println("[PixelMV] Verbindung zur Datenbank hergestellt!");
- } catch (SQLException e) {
- System.out.println("[PixelMV] Es gab einen Fehler!");
- e.printStackTrace();
- }
- }
- public static void update(String up) {
- try {
- Statement s = conn.createStatement();
- s.executeUpdate(up);
- s.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- public static ResultSet query(String up) {
- ResultSet r = null;
- try{
- Statement s = conn.createStatement();
- r = s.executeQuery(up);
- }catch(SQLException e) {
- e.printStackTrace();
- }
- return r;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement