Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Connection conn = null;
- java.sql.PreparedStatement ps = null;
- ResultSet ds = null;
- try {
- conn = DriverManager.getConnection("jdbc:mysql://localhost:3307/minecraft_server","root", "");
- ps = conn.prepareStatement("INSERT INTO packages (from, to, item, amount, damage, message, date, opened)" + "VALUES (?,?,?,?,?,?,?,?)",Statement.RETURN_GENERATED_KEYS);
- ps.setInt(1, playerFrom);
- ps.setInt(2, playerTo);
- ps.setInt(3, sendItem);
- ps.setInt(4, sendAmount);
- ps.setInt(5, sendDamage);
- ps.setString(6, message);
- ps.setString(7, playerInformation.DateUtils.now());
- ps.setInt(8, 0);
- ps.executeUpdate();
- } catch (SQLException ex) {
- log.info("[Package Send Command] - Unable to log unique message into SQL");
- ex.printStackTrace();
- } finally {
- try {
- if (ps != null)
- player.sendMessage("Logged!");
- ps.close();
- if (ds != null)
- ds.close();
- if (conn != null)
- conn.close();
- } catch (SQLException ex) {
- }
- }
Add Comment
Please, Sign In to add comment