Thread: problem with setting boolean value on AbstractJdbc1Statement
Hello, I get the following error when the JBoss EJB container attempts to set a BOOLEAN value on the AbstractJdbc1Statement: Unknown Types value. at org.postgresql.jdbc1.AbstractJdbc1Statement.setObject (AbstractJdbc1Statement.java:1423) at org.postgresql.jdbc1.AbstractJdbc1Statement.setObject (AbstractJdbc1Statement.java:1429) at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.setObject (WrappedPreparedStatement.java:607) at org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.setParameter (JDBCUtil.java:292) . . . I'm running Postgres 7.3.2 on Red Hat (and Windows) using the latest JDBC3 driver. Any thoughts, ideas from anyone? Thanks, Stuart
On Fri, Sep 26, 2003 at 11:02:05AM -0400, Stuart M Easterling wrote: > > Hello, > > I get the following error when the JBoss EJB container attempts to set a > BOOLEAN value on the AbstractJdbc1Statement: > > Unknown Types value. > at org.postgresql.jdbc1.AbstractJdbc1Statement.setObject > (AbstractJdbc1Statement.java:1423) > at org.postgresql.jdbc1.AbstractJdbc1Statement.setObject > (AbstractJdbc1Statement.java:1429) > at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.setObject > (WrappedPreparedStatement.java:607) > at org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.setParameter > (JDBCUtil.java:292) > . > . > . > > I'm running Postgres 7.3.2 on Red Hat (and Windows) using the latest JDBC3 > driver. > > Any thoughts, ideas from anyone? From the stack trace you're not running the most recent JDBC3 code. In CVS, Types.BOOLEAN is translated to Types.BIT in AbstractJdbc3Statement and then passed to the superclass. If you're running a JDBC1 or JDBC2 build, then that translation will not happen, and AbstractJdbc1Statement does not understand Types.BOOLEAN. I'm not sure when this behaviour was introduced, though, perhaps it hasn't made it into the current JDBC3 binaries. Try rebuilding the driver from CVS and see if the problem goes away? -O
Stuart, There isn't a lot of information to go on here. Without knowing what the values are that are being passed to the driver, it is difficult to know what the problem might be. A simple test case would be necessary for me to look into this further. When you say you are running the latest driver, what do you mean by 'latest'? (latest = latest 7.3 build, or latest 7.4 build, or latest cvs pull?) thanks, --Barry Stuart M Easterling wrote: > Hello, > > I get the following error when the JBoss EJB container attempts to set a > BOOLEAN value on the AbstractJdbc1Statement: > > Unknown Types value. > at org.postgresql.jdbc1.AbstractJdbc1Statement.setObject > (AbstractJdbc1Statement.java:1423) > at org.postgresql.jdbc1.AbstractJdbc1Statement.setObject > (AbstractJdbc1Statement.java:1429) > at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.setObject > (WrappedPreparedStatement.java:607) > at org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.setParameter > (JDBCUtil.java:292) > . > . > . > > I'm running Postgres 7.3.2 on Red Hat (and Windows) using the latest JDBC3 > driver. > > Any thoughts, ideas from anyone? > > Thanks, > Stuart > > > ---------------------------(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 >
OK, when I set the JDBC type to BIT it works fine for a BOOLEAN field. Thanks for the feedback. For some reason JBoss is using the AbstractJdbc1Statement as opposed to AbstractJdbc3Statement, even when the latter is available. This is odd, I think I need to dig in the config files. (I'm using pg73jdbc3.jar, last build 2003-08-07.) Cheers, Stuart Oliver Jowett wrote: > From the stack trace you're not running the most recent JDBC3 code. In CVS, Types.BOOLEAN is translated to Types.BIT in AbstractJdbc3Statement and then passed to the superclass. If you're running a JDBC1 or JDBC2 build, then that translation will not happen, and AbstractJdbc1Statement does not understand Types.BOOLEAN. > > I'm not sure when this behaviour was introduced, though, perhaps it hasn't made it into the current JDBC3 binaries. Try rebuilding the driver from CVS and see if the problem goes away? Barry Lind wrote: > Stuart, > > There isn't a lot of information to go on here. Without knowing what the values are that are being passed to the driver, it is difficult to know what the problem might be. A simple test case would be necessary for me to look into this further. > > When you say you are running the latest driver, what do you mean by 'latest'? (latest = latest 7.3 build, or latest 7.4 build, or latest cvs pull?) > > thanks, > --Barry > > > Stuart M Easterling wrote: >> Hello, >> I get the following error when the JBoss EJB container attempts to set a BOOLEAN value on the AbstractJdbc1Statement: >> Unknown Types value. >> at org.postgresql.jdbc1.AbstractJdbc1Statement.setObject >> (AbstractJdbc1Statement.java:1423) >> at org.postgresql.jdbc1.AbstractJdbc1Statement.setObject >> (AbstractJdbc1Statement.java:1429) >> at >> org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.setObject >> (WrappedPreparedStatement.java:607) >> at org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.setParameter >> (JDBCUtil.java:292) >> . >> . >> . >> I'm running Postgres 7.3.2 on Red Hat (and Windows) using the latest JDBC3 driver. >> Any thoughts, ideas from anyone? >> Thanks, >> Stuart * Stuart M. Easterling Software Engineer Virtual Agora Project InSITeS/CAAE Carnegie Mellon University stuarte@cmu.edu 412|268|5392
Stuart M Easterling wrote: > For some reason JBoss is using the AbstractJdbc1Statement as opposed to > AbstractJdbc3Statement, even when the latter is available. This is odd, I > think I need to dig in the config files. (I'm using pg73jdbc3.jar, last build > 2003-08-07.) This isn't necessarily surprising, since AbstractJdbc3Statement is a subclass of AbstractJdbc1Statement with most of the logic residing in AbstractJdbc1Statement. --Barry
On Mon, Sep 29, 2003 at 10:24:07AM -0400, Stuart M Easterling wrote: > > OK, when I set the JDBC type to BIT it works fine for a BOOLEAN field. Thanks > for the feedback. > > For some reason JBoss is using the AbstractJdbc1Statement as opposed to > AbstractJdbc3Statement, even when the latter is available. This is odd, I > think I need to dig in the config files. (I'm using pg73jdbc3.jar, last build > 2003-08-07.) Looking at CVS, correct handling of Types.BOOLEAN was only committed on 2003-09-17: revision 1.3 date: 2003/09/17 05:07:38; author: barry; state: Exp; lines: +12 -1 Applied patch from Kim Ho at redhat to improve boolean and bit handling in the jdbc driver so Types.BOOLEAN won't work with the build you're using. This change also introduced the override of setObject() in AbstractJdbc3Statement, which explains why you don't see AbstractJdbc3Statement at all in your stack trace. There doesn't seem to be a build that includes this change on jdbc.postgresql.org, so it looks like you need to build from CVS or keep using Types.BIT as a workaround. -O