Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE ticket (
- start_time DATETIME NOT NULL,
- end_time DATETIME NOT NULL,
- seat VARCHAR(50) NOT NULL,
- sep VARCHAR(50) NOT NULL,
- price INT(50) NOT NULL,
- foroom VARCHAR(50) NOT NULL,
- printer INT(15) NOT NULL,
- PRIMARY KEY (seat)
- );
- try
- {
- System.out.println("Attempting to connect...n");
- Class.forName("com.mysql.jdbc.Driver");
- connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/baseis?autoReconnect=true&useSSL=false","root","");
- System.out.println("Connection Succesful!!!");
- String sql = "INSERT INTO ticket (start_time)" + " VALUES (?)";
- PreparedStatement prepared = connection.prepareStatement(sql);
- prepared.setString(1,"2016-07-17 19:00:00");
- prepared.executeUpdate(sql);
- }
- catch(SQLException error)
- {
- System.out.println("Error: " + error.getMessage());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement