Advertisement
Guest User

Untitled

a guest
Sep 6th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. public void submit() {
  2. System.out.println("Test:" + buttonCounter);
  3.  
  4. PreparedStatement preparedStatement = null;
  5. Connection connection = null;
  6.  
  7. try {
  8. String connectionString = "jdbc:mysql://188.166.215.160:3306/isys3400?useSSL=false";
  9. connection = DriverManager.getConnection(connectionString, "application", "@ISYS3400project");
  10.  
  11. preparedStatement = connection.prepareStatement(
  12. "INSERT INTO Tester (number) "
  13. + "VALUES (now(),?)");
  14. String number = buttonCounter;
  15.  
  16. preparedStatement.setString(1, number);
  17.  
  18. preparedStatement.executeUpdate();
  19.  
  20. } catch (SQLException e) {
  21. System.out.println("SQLException: " + e.getMessage());
  22. System.out.println("SQLState: " + e.getSQLState());
  23. }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement