Home > Archive > PostgreSQL JDBC > November 2005 > Can PostgreSQL do data type automated casting in prepared statement?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Can PostgreSQL do data type automated casting in prepared statement?
Tjioe Ai Xin

2005-11-21, 7:23 am

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

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com