Call PostgreSQL function from Java JDBC driver

1.4k views Asked by At

I call a procedure in the following way:

CallableStatement delete_procedure = connection.prepareCall("{ call schema.delete( ? ) }");

delete_procedure.setInt(1, id);
delete_procedure.execute();
delete_procedure.close();

connection.close();

When I run the command delete_procedure.execute(), the program crashes. I do not experience any exceptions. What is causing this behavior? I am using the following function, which works fine:

CREATE OR REPLACE FUNCTION schema.delete(integer)
    RETURNS void AS
alter table schema.table disable trigger del_trg;
delete from schema.table where id = $1;
alter table schema.table enable trigger del_trg;
0

There are 0 answers