Code example for PreparedStatement

Methods: close, setBytes, setString

0
        Connection con = getDataSource().getConnection();
        con.prepareStatement("create table \"testlob\" (\"fid\" serial primary key, " +
        		"\"blob_field\" BYTEA, \"clob_field\" TEXT)").execute();
         
        PreparedStatement ps =con.prepareStatement( "INSERT INTO \"testlob\" (\"blob_field\",\"clob_field\")  VALUES (?,?)");
        ps.setBytes(1, new byte[] {1,2,3,4,5});
        ps.setString(2, "small clob");
        ps.execute();
        ps.close();
        con.close();               
    } 
 
    @Override 
    protected void dropLobTable() throws Exception { 
        runSafe("DROP TABLE \"testlob\""); 
    } 
 
}