pgjdbc-ng
pgjdbc-ng copied to clipboard
Postgres stored procedures via CallableStatement
Hello.
Since Postrges JBDC driver cannot work with stored procedures (only functions) via CallableStatement, I tried pgjdbc-ng one.
During the execution of the following code I get the exception:
com.impossibl.postgres.jdbc.PGSQLSimpleException: get_organization(bigint, character varying, numeric, integer, jsonb, character varying) is a procedure
`
CallableStatement cs = con.prepareCall("{CALL get_organization(?,?,?,?,?::jsonb,?)}")) {
cs.setObject(1, id, Types.BIGINT);
cs.setObject(2, kbm, Types.VARCHAR);
cs.setBigDecimal(3, BigDecimal.ONE);
cs.setInt(4, 0);
cs.setObject(5, "");
cs.setString(6, "");
cs.registerOutParameter(3, Types.NUMERIC);
cs.registerOutParameter(4, Types.INTEGER);
cs.registerOutParameter(5, Types.OTHER);
cs.registerOutParameter(6, Types.VARCHAR);
ResultSet rs = cs.executeQuery();
`
What does it mean? That this driver cannot work with postgres stored procedures either? I found zero information related to this. FYI: The procedure has 2 IN parameters and 4 INOUT parameters.
The better question is why do you want to use a stored procedure ? They kinda suck at the moment
I am a test automation engineer, and have to call stored procedures since our developers use them in application. I cannot forbid our devs from using them.
The question is still actual.