Advertisement
Guest User

Untitled

a guest
Aug 10th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. CREATE TABLE ticket (
  2. start_time DATETIME NOT NULL,
  3. end_time DATETIME NOT NULL,
  4. seat VARCHAR(50) NOT NULL,
  5. sep VARCHAR(50) NOT NULL,
  6. price INT(50) NOT NULL,
  7. foroom VARCHAR(50) NOT NULL,
  8. printer INT(15) NOT NULL,
  9. PRIMARY KEY (seat)
  10. );
  11.  
  12. try
  13. {
  14. System.out.println("Attempting to connect...n");
  15. Class.forName("com.mysql.jdbc.Driver");
  16. connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/baseis?autoReconnect=true&useSSL=false","root","");
  17. System.out.println("Connection Succesful!!!");
  18. String sql = "INSERT INTO ticket (start_time)" + " VALUES (?)";
  19. PreparedStatement prepared = connection.prepareStatement(sql);
  20. prepared.setString(1,"2016-07-17 19:00:00");
  21. prepared.executeUpdate(sql);
  22. }
  23. catch(SQLException error)
  24. {
  25. System.out.println("Error: " + error.getMessage());
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement