Code example for Connection

Methods: createStatement

0
 
    @Before 
    public void connect() throws Exception 
    { 
        conn = DriverManager.getConnection("jdbc:sqlite:");
        stat = conn.createStatement();
        stat.executeUpdate("create table People (pid integer primary key autoincrement, "
                + " firstname string, surname string, dob date);"); 
        stat.executeUpdate("insert into people values (null, 'Mohandas', 'Gandhi', " + " '1869-10-02');");
        meta = stat.executeQuery("select pid, firstname, surname from people;").getMetaData();
    } 
 
    @After 
    public void close() throws SQLException 
    { 
        stat.executeUpdate("drop table people;");
        stat.close();
        conn.close();
    } 
 
Contextual code suggestions in your IDE  Get Codota for Java