You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by ilkayaktas <as...@gmail.com> on 2009/03/17 09:32:16 UTC

ibatis - Sybase String problem

Hi everyone,
i got a problem in ibatis. I have an insert sql in xml file like :

<insert id="insert"
parameterClass="tr.com.cs.peb.hedef.model.HedefTanimlariOM">
		INSERT INTO
		HEDEF_TANIMLARI (OID, VERSION, AD)
		VALUES (#oid#, #version#, #ad#)
</insert>

class HedefTanimlariOM{
     String oid;
     String version;
     String ad;
}

when i send parameter which oid and version are valid but ad is null, sybase
send an error 'JZ0SM: Unsupported SQL type 0'. When i look into the log file
i see:
INSERT INTO   HEDEF_TANIMLARI (OID, VERSION, AD) VALUES(?,?,?)
Parameters: [12b2czfsedqv9e00, 0, null]
Types: [java.lang.String, java.lang.String, null]

last parameter's type seems null. Mysql deosn't throw any exception but
sybase does. How can i fix it?
-- 
View this message in context: http://www.nabble.com/ibatis---Sybase-String-problem-tp22554502p22554502.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: ibatis - Sybase String problem

Posted by ilkayaktas <as...@gmail.com>.
Thx my friend, it worked.


Brian Bruns wrote:
> 
> You need to explicitly give it the type, so if AD was an int:
> 
> INSERT INTO
>                 HEDEF_TANIMLARI (OID, VERSION, AD)
>                 VALUES (#oid#, #version#, #ad:INT#)
> 
> I've not seen Sybase require this, but DB2 needs the type for null
> values.  In general it's a good idea for portability.  MySQL is a
> little loose with what it accepts, for better or worse.
> 
> Brian
> 
> 2009/3/17 ilkayaktas <as...@gmail.com>:
>>
>> Hi everyone,
>> i got a problem in ibatis. I have an insert sql in xml file like :
>>
>> <insert id="insert"
>> parameterClass="tr.com.cs.peb.hedef.model.HedefTanimlariOM">
>>                INSERT INTO
>>                HEDEF_TANIMLARI (OID, VERSION, AD)
>>                VALUES (#oid#, #version#, #ad#)
>> </insert>
>>
>> class HedefTanimlariOM{
>>     String oid;
>>     String version;
>>     String ad;
>> }
>>
>> when i send parameter which oid and version are valid but ad is null,
>> sybase
>> send an error 'JZ0SM: Unsupported SQL type 0'. When i look into the log
>> file
>> i see:
>> INSERT INTO   HEDEF_TANIMLARI (OID, VERSION, AD) VALUES(?,?,?)
>> Parameters: [12b2czfsedqv9e00, 0, null]
>> Types: [java.lang.String, java.lang.String, null]
>>
>> last parameter's type seems null. Mysql deosn't throw any exception but
>> sybase does. How can i fix it?
>> --
>> View this message in context:
>> http://www.nabble.com/ibatis---Sybase-String-problem-tp22554502p22554502.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/ibatis---Sybase-String-problem-tp22554502p22739411.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: ibatis - Sybase String problem

Posted by Larry Meadors <la...@gmail.com>.
Well, "All JDBC drivers *should* require the type to be specified..." :-)

Larry


On Tue, Mar 17, 2009 at 10:28 AM, Clinton Begin <cl...@gmail.com> wrote:
> All JDBC drivers require the type to be specified, as it's part of the spec...

Re: ibatis - Sybase String problem

Posted by Clinton Begin <cl...@gmail.com>.
All JDBC drivers require the type to be specified, as it's part of the
spec...

INSERT INTO
               HEDEF_TANIMLARI (OID, VERSION, AD)
               VALUES (#oid#, #version#, #ad:*VARCHAR*#)


On Tue, Mar 17, 2009 at 6:55 AM, Brian Bruns <br...@gmail.com> wrote:

> You need to explicitly give it the type, so if AD was an int:
>
> INSERT INTO
>                HEDEF_TANIMLARI (OID, VERSION, AD)
>                 VALUES (#oid#, #version#, #ad:INT#)
>
> I've not seen Sybase require this, but DB2 needs the type for null
> values.  In general it's a good idea for portability.  MySQL is a
> little loose with what it accepts, for better or worse.
>
> Brian
>
> 2009/3/17 ilkayaktas <as...@gmail.com>:
> >
> > Hi everyone,
> > i got a problem in ibatis. I have an insert sql in xml file like :
> >
> > <insert id="insert"
> > parameterClass="tr.com.cs.peb.hedef.model.HedefTanimlariOM">
> >                INSERT INTO
> >                HEDEF_TANIMLARI (OID, VERSION, AD)
> >                VALUES (#oid#, #version#, #ad#)
> > </insert>
> >
> > class HedefTanimlariOM{
> >     String oid;
> >     String version;
> >     String ad;
> > }
> >
> > when i send parameter which oid and version are valid but ad is null,
> sybase
> > send an error 'JZ0SM: Unsupported SQL type 0'. When i look into the log
> file
> > i see:
> > INSERT INTO   HEDEF_TANIMLARI (OID, VERSION, AD) VALUES(?,?,?)
> > Parameters: [12b2czfsedqv9e00, 0, null]
> > Types: [java.lang.String, java.lang.String, null]
> >
> > last parameter's type seems null. Mysql deosn't throw any exception but
> > sybase does. How can i fix it?
> > --
> > View this message in context:
> http://www.nabble.com/ibatis---Sybase-String-problem-tp22554502p22554502.html
> > Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >
> >
>

Re: ibatis - Sybase String problem

Posted by Brian Bruns <br...@gmail.com>.
You need to explicitly give it the type, so if AD was an int:

INSERT INTO
                HEDEF_TANIMLARI (OID, VERSION, AD)
                VALUES (#oid#, #version#, #ad:INT#)

I've not seen Sybase require this, but DB2 needs the type for null
values.  In general it's a good idea for portability.  MySQL is a
little loose with what it accepts, for better or worse.

Brian

2009/3/17 ilkayaktas <as...@gmail.com>:
>
> Hi everyone,
> i got a problem in ibatis. I have an insert sql in xml file like :
>
> <insert id="insert"
> parameterClass="tr.com.cs.peb.hedef.model.HedefTanimlariOM">
>                INSERT INTO
>                HEDEF_TANIMLARI (OID, VERSION, AD)
>                VALUES (#oid#, #version#, #ad#)
> </insert>
>
> class HedefTanimlariOM{
>     String oid;
>     String version;
>     String ad;
> }
>
> when i send parameter which oid and version are valid but ad is null, sybase
> send an error 'JZ0SM: Unsupported SQL type 0'. When i look into the log file
> i see:
> INSERT INTO   HEDEF_TANIMLARI (OID, VERSION, AD) VALUES(?,?,?)
> Parameters: [12b2czfsedqv9e00, 0, null]
> Types: [java.lang.String, java.lang.String, null]
>
> last parameter's type seems null. Mysql deosn't throw any exception but
> sybase does. How can i fix it?
> --
> View this message in context: http://www.nabble.com/ibatis---Sybase-String-problem-tp22554502p22554502.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>