|
|
Choosing A Webhost: |
BIT vs boolean: msg#00132db.postgresql.jdbc
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
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: executeQuery and busy waiting, Dave Cramer |
|---|---|
| Next by Date: | Re: ENC: Client_encoding, Barry Lind |
| Previous by Thread: | executeQuery and busy waiting, Garrick Dasbach |
| Next by Thread: | Re: BIT vs boolean, Fernando Nasser |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |