Passing parameters to functions from Java

Поиск
Список
Период
Сортировка
От Sean Elliott
Тема Passing parameters to functions from Java
Дата
Msg-id 7928EBAE915DD411B2D20008C75D394805AB2274@vivaldi.which.co.uk
обсуждение исходный текст
Список pgsql-jdbc

Having trouble with dates and smallints so far.

I think you get around it using casts like this:

                CallableStatement cs = conn.prepareCall("{ ? = call ifc_send_status_change( date(?), int2(?) )}");

                java.sql.Date date;

                date = new java.sql.Date(2002 - 1900, 02 - 1, 26);

                System.out.println("date is " + date);

                cs.registerOutParameter(1, Types.INTEGER);

                cs.setString(2, "2002-02-26");

//              cs.setShort(2, (short)1);

//              cs.setDate(2, date);

                cs.setShort(3, (short)2);

                // 2002-02-26, 1

                cs.execute();

                int rowCount = cs.getInt(1);

                System.out.println("row count is " + rowCount);

Is there any decent documentation on this? Can't find any by the obvious routes - all examples are too trivial.

Regards

Sean Elliott


CONFIDENTIAL NOTICE
This communication contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient please note that any distribution, copying or use of this communication or the information in it is strictly prohibited. If you received this communication in error, please notify us by e-mail or by telephone (020 7770 7000) and then delete the e-mail and any copies of it.

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Olivier Crameri
Дата:
Сообщение: problem with postgres jdbc driver and Java 1.4.2 sdk
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: problem with postgres jdbc driver and Java 1.4.2 sdk