Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. public static void createTables(){
  2.         Connection con = null;
  3.         try{
  4.             Class.forName("com.mysql.jdbc.Driver");
  5.             con = DriverManager.getConnection("jdbc:mysql://localhost/ablog","root","dick4");
  6.             try{
  7.                 Statement st = con.createStatement();
  8.                 String t="CREATE TABLE attempts (indexnumber integer unsigned auto_increment not null, date date not null, buy boolean not null default '0', itemname text not null";
  9.                
  10.                 st.executeUpdate(t);
  11.                 System.out.println("Table creation process successfully!");
  12.             }
  13.             catch (SQLException s){
  14.                 System.out.println("SQL statement "+which+" is not executed!");
  15.             }
  16.         }
  17.         catch (Exception e){
  18.             e.printStackTrace();
  19.         }
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement