title: Create postgresql Table in java code
body: <p>I have a code in java that connects with postgreSQL database.</p>
  
  <p>now, I want that when it connects to the database, i will also create database table.</p>
  
  <p>but my problem is that, it will not create the database, and I don't know what is the problem.</p>
  
  <p>here is my code:</p>
  
  <pre><code>Statement st = null;
          ResultSet rs = null;
          try{
              Class.forName("org.postgresql.Driver");
              System.out.println("connect");
              } catch (ClassNotFoundException cnfe){
                System.out.println("Could not find the JDBC driver!");
                System.exit(1);
              }
          Connection conn = null;
          try {
              //database location, database user, database password
              conn = DriverManager.getConnection
                             ("jdbc:postgresql:"POS_DB","postgres", "123456");
              st = conn.createStatement();
              String qs = "CREATE TABLE IF NOT EXISTS user(user_id SERIAL NOT NULL PRIMARY KEY,username varchar(225) NOT NULL UNIQUE,password varchar(225),islogged varchar(10))";
              String qs1 = "SELECT * FROM test";
          rs = st.executeQuery(qs);
  
              System.out.println("connect");
               } catch (SQLException sqle) {
                 System.out.println("Could not connect");
                 System.exit(1);
               }
  </code></pre>
  
  <p>I am sure that my sql statement in creating the table is correct. but when I run this, it will not create the table. If I replace the string into <code>select</code> sql, there is no problem.</p>
  
  <p>does anyone have an idea about my case?</p>
  
  <p>thanks in advance ..</p>