| From: | Fernando Nasser <fnasser(at)redhat(dot)com> |
|---|---|
| To: | Darin Ohashi <DOhashi(at)maplesoft(dot)com> |
| Cc: | pgsql-jdbc(at)postgresql(dot)org, Kim Ho <kho(at)redhat(dot)com> |
| Subject: | Re: BIT vs boolean |
| Date: | 2003-06-27 20:33:39 |
| Message-ID: | 3EFCAA23.6090103@redhat.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-jdbc |
I think there is a patch posted for this already.
Kim can confirm if that is so.
Fernando
Darin Ohashi wrote:
> According to the jdbc doc's one should set a BIT value in a prepared statement
> using the setBoolean function. So I think the following should work:
>
> stat = con.createStatement();
>
> stat.execute( "CREATE TABLE bitTable( b BIT )" );
>
> pstat = con.prepareStatement( "INSERT INTO bitTable( b ) VALUES( ? )" );
>
> pstat.setBoolean( 1, true );
>
> pstat.execute();
>
> However with pgsql-jdbc 7.3.3 build 110, I get the following error:
>
> Exception in thread "main" java.sql.SQLException: ERROR: Cannot parse 't' as a
> binary digit
>
> at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)
> at
> org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.jav
> a:505)
> at
> org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:
> 320)
> at
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:
> 48)
> at SQLBug.main(SQLBug.java:34)
>
> Is setBoolean is just printing true or false into a string and expecting the
> database side to parse it? Maybe it should check the type of the column to
> determine if the boolean value should be printed as true/false or 0/1 (or
> whatever BIT is expecting to see).
>
> Darin
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
>
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser(at)redhat(dot)com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
| From | Date | Subject | |
|---|---|---|---|
| Next Message | scott.marlowe | 2003-06-27 20:46:20 | Re: executeQuery and busy waiting |
| Previous Message | Fernando Nasser | 2003-06-27 20:12:26 | Re: Multiple Out params in stored procs |