April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
n
nimport java.sql.*;
n
nclass CriaTabela {
n  public static void main(String[] args) throws Exception {
n    Class.forName("org.postgresql.Driver");
n    String url = "jdbc:postgresql:teste";
n    String user = "usuario";
n    String pass = "senha";
n    Connection db = DriverManager.getConnection(url,user,pass);
n    Statement st = db.createStatement();
n    int ok = st.executeUpdate("create table senhas ("+
n                              "  nome varchar(80) not null unique,"+
n                              "  senha varchar(16) not null"+
n                              ")");
n    System.out.println("ok.");
n    st.close();
n    db.close();
n  }
n}
Criar uma tabela