From: | Sean Elliott <Sean(dot)Elliott(at)which(dot)co(dot)uk> |
---|---|
To: | "'pgsql-jdbc(at)postgresql(dot)org'" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Passing parameters to functions from Java |
Date: | 2004-03-02 17:07:35 |
Message-ID: | 7928EBAE915DD411B2D20008C75D394805AB2274@vivaldi.which.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Nicholas Veeser | 2004-03-02 21:41:11 | No Exception thrown when there is a constraint violation, and delete fails |
Previous Message | Bhushan Bhangale | 2004-03-02 15:44:51 | Re: calling function |