Search Postgresql Archives

Re: Errors using JDBC batchUpdate with plpgsql function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,


>          String sql = "select test_user_result_insert_func(?, ?, ?);";

You can't call functions via JDBC like that. You need to use:

CallableStatement cs = connection.prepareCall("{call func(?,?,?)}");

// Loop starts...
cs.clearParameters();
cs.setString(1, "foo");
cs.setString(2, "bar");
cs.setString(3, "baz");
cs.addBatch();
// Loop ends

cs.executeBatch();



See also: https://jdbc.postgresql.org/documentation/94/callproc.html



Best regards,

	-hannes




--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux