You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Sebastien Lucas <se...@gmail.com> on 2005/09/05 16:45:13 UTC

ORA-01036 error with parameterMap (Blob column)

Hi,

I use IBatis.Net for a big project and without any problem ....... except 
today.

First the background : I use the DataMapper 1.2.1 with c# and my database is 
Oracle 10g.

my problem is with the only table of my project with a Blob column. Here is 
the sql :

CREATE TABLE T_FACE_PHOTO ( 
FPH_NUM NUMBER (10) NOT NULL, 
FPH_IMAGE BLOB NOT NULL, 
FPH_COMMENTAIRES VARCHAR2 (4000), 
FPH_FAC_CODE VARCHAR2 (20) NOT NULL, 
USER_CREATION VARCHAR2 (50), 
DATE_CREATION DATE, 
USER_MODIF VARCHAR2 (50), 
DATE_MODIF DATE, 
VERSION NUMBER (3) DEFAULT 0 NOT NULL, 
CONSTRAINT PK_T_FACE_PHOTO
PRIMARY KEY ( FPH_NUM ) ) ; 

I built the following sqlmap :

<?xml version='1.0'?>


<!-- ATTENTION: Ceci est un fichier genere automatiquement. Ne pas modifier 
-->

<sqlMap namespace="TFacePhoto" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="
SqlMap.xsd">

<alias>

<typeAlias alias="TFacePhoto" type="
GB.Persistance.Metier.Patrimoine.TFacePhoto, Persistance" />

</alias>


<statements>


<insert id="insertTFacePhoto" parameterMap="insert-tfacephoto-param" >
<selectKey resultClass="int" type="pre" property="DbNum" >
select FPH_NUM.nextval as value from dual
</selectKey>
insert into T_FACE_PHOTO 
(FPH_NUM, FPH_COMMENTAIRES, FPH_FAC_CODE, FPH_IMAGE, USER_CREATION, 
USER_MODIF, DATE_MODIF, VERSION)
values
(?, ?, ?, ?, ?, ?, ?)
</insert>

</statements>

<parameterMaps>

<parameterMap id="insert-tfacephoto-param">
<parameter property="DbNum" />
<parameter property="DbCommentaires" />
<parameter property="DbFacCode" />
<parameter property="DbImage" dbType="Blob"/>
<parameter property="DbUserCreation" />
<parameter property="DbUserModif" />
<parameter property="DbDateModif" />
<parameter property="DbVersion" />
</parameterMap>

</parameterMaps>

</sqlMap>

This sqlmap cause an Oracle ORA01036 error each time I try to insert a row 
in the database.

The funny part is that if I remove the parameter DbDateModif and change the 
insert to also remove the column DATE_MODIF, I can insert without any 
problem.

My c# class shouldn't be the problem, So I'm totally lost here.

Thanks in advance for any hints or (better) a solution ;)

Sebastien

Re: ORA-01036 error with parameterMap (Blob column)

Posted by Sebastien Lucas <se...@gmail.com>.
On 9/12/05, Sebastien Lucas <se...@gmail.com> wrote:
> 
> On 9/6/05, Sebastien Lucas <se...@gmail.com> wrote:
> > 
> > On 9/6/05, Roberto R <ro...@gmail.com> wrote: 
> > > 
> > > Hi Sebastien.
> > > 
> > > Is there a value that is being inserted into DATE_MOTIF? What is the 
> > > date format that the Oracle DB expects (NLS_DATE_FORMAT)? What is the format 
> > > it is using on insert? Do you have any other SqlMap statements that insert 
> > > or update a date successfully?
> > > 
> > > Roberto
> > > 
> > 
> > Hi Roberto,
> > 
> > Is there a value that is being inserted into DATE_MOTIF?
> > Yes there is a value inserted. See answer 3 for the exact content.
> > 
> > What is the date format that the Oracle DB expects (NLS_DATE_FORMAT)? 
> > I'll check that.
> > 
> > What is the format it is using on insert?
> > I use a DateTime object initialized with DateTime.Today or DateTime.Now. 
> > I let Ibatis do the conversion for me (It works great with resultMap)
> > 
> > Do you have any other SqlMap statements that insert or update a date 
> > successfully?
> > I successfully insert dates in all other tables. every table of my 
> > project has those fields USER_CREATION (user who create the row) 
> > DATE_CREATION (creation's date of the row) and the same with modification 
> > (MODIF). In all the other tables I never use a parameterMap I only use a 
> > resultMap. That's the difference.
> > 
> > I'm currently busy with another problem, I'll check the NLS_DATE_FORMAT 
> > tomorrow morning.
> > 
> > Thanks a lot for helping me.
> > 
> > Sebastien.
> > 
> 
> 
> Sorry for my late answer,
> 
> The NLS_DATE_FORMAT is the default one :
> DD-MON-YY
> 
> Hope this helps.
> 
> Sebastien
> 

Hi,

This is weird but It now works .....

I don't really understand why so I'll assume it was my fault in the first 
place.

Sorry for bothering you and thanks for your help.

Sebastien

Re: ORA-01036 error with parameterMap (Blob column)

Posted by Sebastien Lucas <se...@gmail.com>.
On 9/6/05, Sebastien Lucas <se...@gmail.com> wrote:
> 
> On 9/6/05, Roberto R <ro...@gmail.com> wrote:
> > 
> > Hi Sebastien.
> > 
> > Is there a value that is being inserted into DATE_MOTIF? What is the 
> > date format that the Oracle DB expects (NLS_DATE_FORMAT)? What is the format 
> > it is using on insert? Do you have any other SqlMap statements that insert 
> > or update a date successfully?
> > 
> > Roberto
> > 
> 
> Hi Roberto,
> 
> Is there a value that is being inserted into DATE_MOTIF?
> Yes there is a value inserted. See answer 3 for the exact content.
> 
> What is the date format that the Oracle DB expects (NLS_DATE_FORMAT)? 
> I'll check that.
> 
> What is the format it is using on insert?
> I use a DateTime object initialized with DateTime.Today or DateTime.Now. I 
> let Ibatis do the conversion for me (It works great with resultMap)
> 
> Do you have any other SqlMap statements that insert or update a date 
> successfully?
> I successfully insert dates in all other tables. every table of my project 
> has those fields USER_CREATION (user who create the row) DATE_CREATION 
> (creation's date of the row) and the same with modification (MODIF). In all 
> the other tables I never use a parameterMap I only use a resultMap. That's 
> the difference.
> 
> I'm currently busy with another problem, I'll check the NLS_DATE_FORMAT 
> tomorrow morning.
> 
> Thanks a lot for helping me.
> 
> Sebastien.
> 


Sorry for my late answer,

The NLS_DATE_FORMAT is the default one :
DD-MON-YY

Hope this helps.

Sebastien

Re: ORA-01036 error with parameterMap (Blob column)

Posted by Sebastien Lucas <se...@gmail.com>.
On 9/6/05, Roberto R <ro...@gmail.com> wrote:
> 
> Hi Sebastien.
> 
> Is there a value that is being inserted into DATE_MOTIF? What is the date 
> format that the Oracle DB expects (NLS_DATE_FORMAT)? What is the format it 
> is using on insert? Do you have any other SqlMap statements that insert or 
> update a date successfully?
> 
> Roberto
> 

Hi Roberto,

Is there a value that is being inserted into DATE_MOTIF?
Yes there is a value inserted. See answer 3 for the exact content.

What is the date format that the Oracle DB expects (NLS_DATE_FORMAT)? 
I'll check that.

What is the format it is using on insert?
I use a DateTime object initialized with DateTime.Today or DateTime.Now. I 
let Ibatis do the conversion for me (It works great with resultMap)

Do you have any other SqlMap statements that insert or update a date 
successfully?
I successfully insert dates in all other tables. every table of my project 
has those fields USER_CREATION (user who create the row) DATE_CREATION 
(creation's date of the row) and the same with modification (MODIF). In all 
the other tables I never use a parameterMap I only use a resultMap. That's 
the difference.

I'm currently busy with another problem, I'll check the NLS_DATE_FORMAT 
tomorrow morning.

Thanks a lot for helping me.

Sebastien.

Re: ORA-01036 error with parameterMap (Blob column)

Posted by Roberto R <ro...@gmail.com>.
Hi Sebastien.

Is there a value that is being inserted into DATE_MOTIF? What is the date 
format that the Oracle DB expects (NLS_DATE_FORMAT)? What is the format it 
is using on insert? Do you have any other SqlMap statements that insert or 
update a date successfully?

Roberto



On 9/6/05, Sebastien Lucas <se...@gmail.com> wrote:
> 
> On 9/5/05, Gilles Bayon <ib...@gmail.com> wrote:
> > 
> > Perhaps, Roberto Rabe who better knows Oracle can help you. 
> 
> 
> Hi Gilles,
> 
> First thanks for answering my question.
> 
> About the size parameter, I already try that without any success. I mainly 
> did copy paste from the unit test.
> 
> I really don't know what's going on with these date parameters ..... I 
> unfortunately don't have any other database to test on to check for a 
> specific Oracle problem.
> 
> If anyone has an idea.
> 
> Thanks in advance.
> 
> Sébastien.
>

Re: ORA-01036 error with parameterMap (Blob column)

Posted by Sebastien Lucas <se...@gmail.com>.
On 9/5/05, Gilles Bayon <ib...@gmail.com> wrote:
> 
> Perhaps, Roberto Rabe who better knows Oracle can help you. 


Hi Gilles,

First thanks for answering my question.

About the size parameter, I already try that without any success. I mainly 
did copy paste from the unit test.

I really don't know what's going on with these date parameters ..... I 
unfortunately don't have any other database to test on to check for a 
specific Oracle problem.

If anyone has an idea.

Thanks in advance.

Sébastien.

Re: ORA-01036 error with parameterMap (Blob column)

Posted by Gilles Bayon <ib...@gmail.com>.
Perhaps, Roberto Rabe who better knows Oracle can help you.

Re: ORA-01036 error with parameterMap (Blob column)

Posted by Gilles Bayon <ib...@gmail.com>.
Hi,
 Have you try to set a size on your parameter
as in Unit test
 
<parameter property="PictureData" dbType="Blob" size="4000"/>
-Gilles

 On 9/5/05, Sebastien Lucas <se...@gmail.com> wrote: 
> 
> Hi,
> 
> I use IBatis.Net for a big project and without any problem ....... except 
> today.
> 
> First the background : I use the DataMapper 1.2.1 with c# and my database 
> is Oracle 10g.
> 
> my problem is with the only table of my project with a Blob column. Here 
> is the sql :
> 
> CREATE TABLE T_FACE_PHOTO ( 
> FPH_NUM NUMBER (10) NOT NULL, 
> FPH_IMAGE BLOB NOT NULL, 
> FPH_COMMENTAIRES VARCHAR2 (4000), 
> FPH_FAC_CODE VARCHAR2 (20) NOT NULL, 
> USER_CREATION VARCHAR2 (50), 
> DATE_CREATION DATE, 
> USER_MODIF VARCHAR2 (50), 
> DATE_MODIF DATE, 
> VERSION NUMBER (3) DEFAULT 0 NOT NULL, 
> CONSTRAINT PK_T_FACE_PHOTO
> PRIMARY KEY ( FPH_NUM ) ) ; 
> 
> I built the following sqlmap :
> 
> <?xml version='1.0'?>
> 
> 
> <!-- ATTENTION: Ceci est un fichier genere automatiquement. Ne pas 
> modifier -->
> 
> <sqlMap namespace="TFacePhoto" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="
> SqlMap.xsd">
> 
> <alias>
> 
> <typeAlias alias="TFacePhoto" type="
> GB.Persistance.Metier.Patrimoine.TFacePhoto, Persistance" />
> 
> </alias>
> 
> 
> <statements>
> 
> 
> <insert id="insertTFacePhoto" parameterMap="insert-tfacephoto-param" >
> <selectKey resultClass="int" type="pre" property="DbNum" >
> select FPH_NUM.nextval as value from dual
> </selectKey>
> insert into T_FACE_PHOTO 
> (FPH_NUM, FPH_COMMENTAIRES, FPH_FAC_CODE, FPH_IMAGE, USER_CREATION, 
> USER_MODIF, DATE_MODIF, VERSION)
> values
> (?, ?, ?, ?, ?, ?, ?)
> </insert>
> 
> </statements>
> 
> <parameterMaps>
> 
> <parameterMap id="insert-tfacephoto-param">
> <parameter property="DbNum" />
> <parameter property="DbCommentaires" />
> <parameter property="DbFacCode" />
> <parameter property="DbImage" dbType="Blob"/>
> <parameter property="DbUserCreation" />
> <parameter property="DbUserModif" />
> <parameter property="DbDateModif" />
> <parameter property="DbVersion" />
> </parameterMap>
> 
> </parameterMaps>
> 
> </sqlMap>
> 
> This sqlmap cause an Oracle ORA01036 error each time I try to insert a row 
> in the database.
> 
> The funny part is that if I remove the parameter DbDateModif and change 
> the insert to also remove the column DATE_MODIF, I can insert without any 
> problem.
> 
> My c# class shouldn't be the problem, So I'm totally lost here.
> 
> Thanks in advance for any hints or (better) a solution ;)
> 
> Sebastien
>