Guest User

Untitled

a guest
Dec 12th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. String sql = "CREATE TABLE users (user_id int AUTO_INCREMENT,"
  2. + " user_name varchar(255),"
  3. + " user_email varchar(255) UNIQUE, "
  4. + " PRIMARY KEY(user_id))";
  5. try (Connection conn = DriverManager.getConnection(
  6. "jdbc:mysql://localhost:3306/my_db?useSSL=false&characterEncoding=utf8",
  7. "root", "coderslab");
  8. Statement stat = conn.createStatement()) {
  9. stat.executeUpdate(sql);
  10. } catch (SQLException e) {
  11. e.printStackTrace();
  12. }
Add Comment
Please, Sign In to add comment