Code example for Connection

Methods: createStatement

0
    public static final String INSERT_ORDERS10 = " INSERT INTO " + ORDERS_TABLE
            + " (onum, amt, odate, cnum, snum) " 
            + "VALUES (3011, 9891.88, 10/06/1990, 2006, 1001)"; 
 
    public static void fillParentTable(Connection conn) throws SQLException {
        Statement statement = conn.createStatement();
        statement
                .execute("INSERT INTO " + PARENT_TABLE + " VALUES(1, 'test1')");
        statement.execute("INSERT INTO " + PARENT_TABLE + " VALUES(2,'test2')");
        statement
                .execute("INSERT INTO " + PARENT_TABLE + " VALUES(3, 'test3')");
    } 
 
    public static void fillFKStrictTable(Connection conn) throws SQLException {
        Statement statement = conn.createStatement();
        statement.execute("INSERT INTO " + FKSTRICT_TABLE
                + " VALUES(1, 1, '1')"); 
        statement.execute("INSERT INTO " + FKSTRICT_TABLE
                + " VALUES(2, 2, '2')"); 
        statement.execute("INSERT INTO " + FKSTRICT_TABLE
                + " VALUES(3, 1, '3')");