diff options
| author | Tobias Spitzer | 2014-06-06 12:32:59 +0200 |
|---|---|---|
| committer | Tobias Spitzer | 2014-06-06 12:32:59 +0200 |
| commit | 039685231a047668e98ad595557eab5ec6447374 (patch) | |
| tree | 6c0ced2b95c51d2b0a446f0a160de3e6f0d0dd7a /bwLehrpool_ServerMaintenance/src/sql/sql.java | |
| parent | Initial Commit (diff) | |
| download | tutor-module-039685231a047668e98ad595557eab5ec6447374.tar.gz tutor-module-039685231a047668e98ad595557eab5ec6447374.tar.xz tutor-module-039685231a047668e98ad595557eab5ec6447374.zip | |
Erste Maintenance Funktion
Diffstat (limited to 'bwLehrpool_ServerMaintenance/src/sql/sql.java')
| -rw-r--r-- | bwLehrpool_ServerMaintenance/src/sql/sql.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/bwLehrpool_ServerMaintenance/src/sql/sql.java b/bwLehrpool_ServerMaintenance/src/sql/sql.java new file mode 100644 index 00000000..61b95172 --- /dev/null +++ b/bwLehrpool_ServerMaintenance/src/sql/sql.java @@ -0,0 +1,51 @@ +package sql; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Date; + +public class sql { + + public Connection getConnection() { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + } catch (InstantiationException | IllegalAccessException + | ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + try { + Connection con = DriverManager + .getConnection("jdbc:mysql://localhost/bwlehrpool?user=bwlp_user&password=!20bwlehrpool14!"); + con.setAutoCommit(false); + + return con; + } catch (SQLException e) { + // TODO Auto-generated catch block + + e.printStackTrace(); + } + return null; + } + + + public void deleteFTPUsers(){ + try { + Connection con=getConnection(); + Statement stm = con.createStatement(); + + stm.executeUpdate("Delete from bwLehrpool.FtpUsers where CreationDate > date_sub(now(),interval 1 day);"); + con.close(); + + + } catch (SQLException e) { + // TODO Auto-generated catch block + + e.printStackTrace(); + } + } + +} |
