ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "March, Andres" <ama...@soe.sony.com>
Subject RE: Postgres insert not working for varbit data type
Date Wed, 04 Jan 2006 23:13:10 GMT
I haven't done the parameter binding in jdbc only hex literals.  This
could be a postgres issue.  Their jdbc driver docs don't even mention
the bit and varbit data types.  They only talk about bytea for
setBytes() and getBytes().  Their other example is for a text data type
which is a blob and uses set/getBinaryStream().  That is not what I
want.  I need a bit varying (VARBINARY in JDBC) data type.  

http://jdbc.postgresql.org/documentation/81/binary-data.html

Any thoughts?

> -----Original Message-----
> From: larry.meadors@gmail.com [mailto:larry.meadors@gmail.com] On
Behalf
> Of Larry Meadors
> Sent: Wednesday, January 04, 2006 2:53 PM
> To: March, Andres
> Subject: Re: Postgres insert not working for varbit data type
> 
> OK, uhm, how would you do this with JDBC directly?
> 
> Larry
> 
> 
> On 1/4/06, March, Andres <amarch@soe.sony.com> wrote:
> > Thanks for the reply.  I guess it is actually a VARBINARY but I
tried
> > both that and BINARY.  Both still give the same error:
> >
> > SqlMapClient operation; bad SQL grammar []; nested exception is
> > com.ibatis.common.jdbc.exception.NestedSQLException: --- The error
> > occurred in com/soe/freerealms/domain/ibatis/MachineState.xml. ---
The
> > error occurred while applying a parameter map. --- Check the
> > MachineState.X86SegReg. --- Check the statement (update failed). ---
> > Cause: org.postgresql.util.PSQLException: ERROR: column "ds" is of
type
> > bit varying but expression is of type bytea
> >
> > > -----Original Message-----
> > > From: larry.meadors@gmail.com [mailto:larry.meadors@gmail.com] On
> > Behalf
> > > Of Larry Meadors
> > > Sent: Wednesday, January 04, 2006 2:36 PM
> > > To: user-java@ibatis.apache.org
> > > Subject: Re: Postgres insert not working for varbit data type
> > >
> > > The jdbcType should be from the Types class:
> > >
> > > http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Types.html
> > >
> > > They look like byte arrays..maybe BINARY would do it.
> > >
> > > Larry
> > >
> > >
> > > On 1/4/06, March, Andres <amarch@soe.sony.com> wrote:
> > > >
> > > >
> > > >
> > > > A Postgres insert not working for varbit data type.  It attempts
to
> > bind
> > > the
> > > > parameters wrong even though I have spcified the jdbcType.
> > > >
> > > > I have used every typeHandler I can find and still the same
result.
> > > > Currently, my config is as follows:
> > > >
> > > >
> > > >
> > > > <sqlMap namespace="MachineState">
> > > >
> > > >
> > > >
> > > >             <parameterMap id="X86SegReg"
> > > > class="com.soe.freerealms.xml.model.X86SegReg">
> > > >
> > > >                         <parameter property="ds" jdbcType="bit
> > varying"
> > > >
> > > >
> > > >
> > >
> >
typeHandler="org.springframework.orm.ibatis.support.BlobByteArrayTypeHan
> > dl
> > > er"
> > > > />
> > > >
> > > >                         <parameter property="es" jdbcType="bit
> > varying"
> > > >
> > > >
> > > >
> > >
> >
typeHandler="org.springframework.orm.ibatis.support.BlobByteArrayTypeHan
> > dl
> > > er"
> > > > />
> > > >
> > > >                         <parameter property="fs" jdbcType="bit
> > varying"
> > > >
> > > >
> > > >
> > >
> >
typeHandler="org.springframework.orm.ibatis.support.BlobByteArrayTypeHan
> > dl
> > > er"
> > > > />
> > > >
> > > >                         <parameter property="gs" jdbcType="bit
> > varying"
> > > >
> > > >
> > > >
> > >
> >
typeHandler="org.springframework.orm.ibatis.support.BlobByteArrayTypeHan
> > dl
> > > er"
> > > > />
> > > >
> > > >             </parameterMap>
> > > >
> > > >             <insert id="insertX86SegReg"
> > > >
> > > >                         parameterMap="X86SegReg">
> > > >
> > > >                         <![CDATA[
> > > >
> > > >                                     insert into x86_seg_reg
> > > > (
> > > >
> > > >                                                 ds,
> > > >
> > > >                                                 es,
> > > >
> > > >                                                 fs,
> > > >
> > > >                                                 gs)
> > > >
> > > >                                     values (
> > > >
> > > >                                                 ?,
> > > >
> > > >                                                 ?,
> > > >
> > > >                                                 ?,
> > > >
> > > >                                                 ?)
> > > >
> > > >                         ]]>
> > > >
> > > >             </insert>
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > </sqlMap>
> > > >
> > > >
> > > >
> > > > And the log:
> > > >
> > > >
> > > >
> > > > 23875 [http-8088-Processor25] DEBUG java.sql.PreparedStatement
-
> > > > {pstm-100001} PreparedStatement:        insert into x86_seg_reg
(
> > > ds,
> > > >   es,      fs,      gs)    values (     ?,      ?,     ?,
?)
> > > >
> > > > 23875 [http-8088-Processor25] DEBUG java.sql.PreparedStatement
-
> > > > {pstm-100001} PreparedStatement:        insert into x86_seg_reg
(
> > > ds,
> > > >   es,      fs,      gs)    values (     ?,      ?,     ?,
?)
> > > >
> > > > 23875 [http-8088-Processor25] DEBUG java.sql.PreparedStatement
-
> > > > {pstm-100001} Parameters: [[B@1af1915, [B@97b7b1, [B@9cd006,
> > [B@11d75b9]
> > > >
> > > > 23875 [http-8088-Processor25] DEBUG java.sql.PreparedStatement
-
> > > > {pstm-100001} Parameters: [[B@1af1915, [B@97b7b1, [B@9cd006,
> > [B@11d75b9]
> > > >
> > > > 23891 [http-8088-Processor25] DEBUG java.sql.PreparedStatement
-
> > > > {pstm-100001} Types: [[B, [B, [B, [B]
> > > >
> > > > 23891 [http-8088-Processor25] DEBUG java.sql.PreparedStatement
-
> > > > {pstm-100001} Types: [[B, [B, [B, [B]
> > > >
> > > >
> > > >
> > > > and the error:
> > > >
> > > >
> > > >
> > > > --- The error occurred in
> > > > com/soe/freerealms/domain/ibatis/MachineState.xml.
> > > >
> > > > --- The error occurred while applying a parameter map.
> > > >
> > > > --- Check the MachineState.X86SegReg.
> > > >
> > > > --- Check the statement (update failed).
> > > >
> > > > --- Cause: org.postgresql.util.PSQLException: ERROR: column
> > > > "ds" is of type bit varying but expression is of type bytea];
SQL
> > was []
> > > for
> > > > task [SqlMapClient operation]
> > > >
> > > >
> > > >
> > > > 24250 [http-8088-Processor25] ERROR
> > > > com.sony.soe.platform.webwork.ExceptionWrapperInterceptor
> > > > - org.springframework.jdbc.BadSqlGrammarException:
> > > > SqlMapClient operation; bad SQL grammar []; nested exception is
> > > > com.ibatis.common.jdbc.exception.NestedSQLException:
> > > >
> > > > --- The error occurred in
> > > > com/soe/freerealms/domain/ibatis/MachineState.xml.
> > > >
> > > > --- The error occurred while applying a parameter map.
> > > >
> > > > --- Check the MachineState.X86SegReg.
> > > >
> > > > --- Check the statement (update failed).
> > > >
> > > > --- Cause: org.postgresql.util.PSQLException: ERROR: column
> > > > "ds" is of type bit varying but expression is of type bytea
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > -----------------------------------------
> > > >
> > > > Andres March
> > > >
> > > > Platform - Apps Engineering
> > > >
> > > > Sony Online Entertainment
> > > >
> > > > desk: 858.577.3373
> > > >
> > > > cell:   619.519.1519
> > > >
> > > >
> >

Mime
View raw message