From: Tjioe Ai Xin <xinxincute@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Can PostgreSQL do data type automated casting in prepared statement?
Date: Mon, 21 Nov 2005 17:18:26 +0700
Message-ID: <200511211718.26679.xinxincute@gmail.com> (raw)
Dear all,
I already used PostgreSQL from version 7.3.3.
So far, I have no problem about using prepared statement especially in data type.
From Mr. Kris Jurka I got answer that it because of different data type when I try to cast them.
>I'm guessing you are using PreparedStatement.setString for a numeric
>value. Do you have a query like "WHERE colname / ? " ? You need to use a
>different setXXX method that takes a numeric value.
My code is like this:
I have query: "Select count(*) / paramPage from tblFirst where condition";
The paramPage were filled from parameter which I specified as string data type.
So I using setString method for my prepared statement for passing paramPage value.
When I'm using the old jdbc driver pg74jdbc3.jar, I got no problem at all.
But when I try to upgrade my PostgreSQL to 8.0.3. I got problem data type error.
Can PostgreSQL do data type automated casting in prepared statement again?
So I do not need change my code :)
Thanks in advance.
Best Regards,
Xin Xin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: xinxincute@gmail.com
Subject: Re: Can PostgreSQL do data type automated casting in prepared statement?
In-Reply-To: <200511211718.26679.xinxincute@gmail.com>
References: <200511211718.26679.xinxincute@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox