You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "sunil kumar (JIRA)" <ib...@incubator.apache.org> on 2006/06/20 00:06:30 UTC

[jira] Created: (IBATIS-309) Cannot insert into Database Blob using IBATIS DAO

Cannot insert into Database Blob using IBATIS DAO
-------------------------------------------------

         Key: IBATIS-309
         URL: http://issues.apache.org/jira/browse/IBATIS-309
     Project: iBatis for Java
        Type: Bug

  Components: SQL Maps, DAO  
    Versions: 2.1.7    
 Environment: Windows 2000, Oracle Application Server and latest version of IBATIS
    Reporter: sunil kumar


I am using Oracle Application Server 10g(9.0.4.0.0) with latest version of IBatis. I am uploading a file and inserting file data as byte[] in the database field which is a Blob. I keep on getting SQLException:Data size bigger than max size for this type when i try to insert. If i take out the file data from my insert statement , a record is inserted into the table. 

My xml mapping file is:

code:
--------------------------------------------------------------------------------

<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <sqlMap namespace="testblob"> 	<typeAlias alias="testForm" type="gov.usaid.testblob.domain.TestForm" /> 	<resultMap id="testFileResult" class="testForm">	 	<result property="fileId"     column="FILE_ID" />	    <result property="fileType" column="FILE_TYPE" /> 	 	<result property="fileName"   column="FILE_NAME" />	 	<result property="fileData"   column="FILE_DATA"  jdbcType="BLOB"/>		<result property="fileSize"   column="FILE_SIZE"/>							</resultMap>	<!--  <select id="downloadFile" resultMap="testFileResult" parameterClass="string">		select * from test_file where file_id=#value#	</select>-->	<insert id="saveFile" parameterClass="testForm">	  <selectKey resultClass="int" keyProperty="fileId">			select SQ_REF_FILE_ID.nextval as FILE_ID from dual	  </selectKey>		insert into TEST_FILE (FILE_ID,FILE_TYPE,FILE_NAME,FILE_SIZE,FILE_DATA)		values (#fileId#, #fileType:VARCHAR#, #fileName#, #fileSize#,#fileData#)	</insert>			</sqlMap>    


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-309) Cannot insert into Database Blob using IBATIS DAO

Posted by "Andrey (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-309?page=comments#action_12429184 ] 
            
Andrey commented on IBATIS-309:
-------------------------------

http://hansonchar.blogspot.com/2005/06/oracle-blob-mapped-to-byte-in.html

Note, with this approach, you may need to use the Oracle 10.1.0.4+ JDBC thin driver regardless to get around a problem related to the blob size greater than 2K bytes (even if you are running the Oracle 9.2.0.x database). Apparently it's related to a bug in the 9.2.0.x JDBC driver.

> Cannot insert into Database Blob using IBATIS DAO
> -------------------------------------------------
>
>                 Key: IBATIS-309
>                 URL: http://issues.apache.org/jira/browse/IBATIS-309
>             Project: iBatis for Java
>          Issue Type: Bug
>          Components: SQL Maps, DAO
>    Affects Versions: 2.1.7
>         Environment: Windows 2000, Oracle Application Server and latest version of IBATIS
>            Reporter: sunil kumar
>
> I am using Oracle Application Server 10g(9.0.4.0.0) with latest version of IBatis. I am uploading a file and inserting file data as byte[] in the database field which is a Blob. I keep on getting SQLException:Data size bigger than max size for this type when i try to insert. If i take out the file data from my insert statement , a record is inserted into the table. 
> My xml mapping file is:
> code:
> --------------------------------------------------------------------------------
> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <sqlMap namespace="testblob"> 	<typeAlias alias="testForm" type="gov.usaid.testblob.domain.TestForm" /> 	<resultMap id="testFileResult" class="testForm">	 	<result property="fileId"     column="FILE_ID" />	    <result property="fileType" column="FILE_TYPE" /> 	 	<result property="fileName"   column="FILE_NAME" />	 	<result property="fileData"   column="FILE_DATA"  jdbcType="BLOB"/>		<result property="fileSize"   column="FILE_SIZE"/>							</resultMap>	<!--  <select id="downloadFile" resultMap="testFileResult" parameterClass="string">		select * from test_file where file_id=#value#	</select>-->	<insert id="saveFile" parameterClass="testForm">	  <selectKey resultClass="int" keyProperty="fileId">			select SQ_REF_FILE_ID.nextval as FILE_ID from dual	  </selectKey>		insert into TEST_FILE (FILE_ID,FILE_TYPE,FILE_NAME,FILE_SIZE,FILE_DATA)		values (#fileId#, #fileType:VARCHAR#, #fileName#, #fileSize#,#fileData#)	</insert>			</sqlMap>    

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Closed: (IBATIS-309) Cannot insert into Database Blob using IBATIS DAO

Posted by "Clinton Begin (JIRA)" <ib...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/IBATIS-309?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Clinton Begin closed IBATIS-309.
--------------------------------

    Resolution: Won't Fix

Was a driver issue

> Cannot insert into Database Blob using IBATIS DAO
> -------------------------------------------------
>
>                 Key: IBATIS-309
>                 URL: https://issues.apache.org/jira/browse/IBATIS-309
>             Project: iBatis for Java
>          Issue Type: Bug
>          Components: DAO, SQL Maps
>    Affects Versions: 2.1.7
>         Environment: Windows 2000, Oracle Application Server and latest version of IBATIS
>            Reporter: sunil kumar
>
> I am using Oracle Application Server 10g(9.0.4.0.0) with latest version of IBatis. I am uploading a file and inserting file data as byte[] in the database field which is a Blob. I keep on getting SQLException:Data size bigger than max size for this type when i try to insert. If i take out the file data from my insert statement , a record is inserted into the table. 
> My xml mapping file is:
> code:
> --------------------------------------------------------------------------------
> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <sqlMap namespace="testblob"> 	<typeAlias alias="testForm" type="gov.usaid.testblob.domain.TestForm" /> 	<resultMap id="testFileResult" class="testForm">	 	<result property="fileId"     column="FILE_ID" />	    <result property="fileType" column="FILE_TYPE" /> 	 	<result property="fileName"   column="FILE_NAME" />	 	<result property="fileData"   column="FILE_DATA"  jdbcType="BLOB"/>		<result property="fileSize"   column="FILE_SIZE"/>							</resultMap>	<!--  <select id="downloadFile" resultMap="testFileResult" parameterClass="string">		select * from test_file where file_id=#value#	</select>-->	<insert id="saveFile" parameterClass="testForm">	  <selectKey resultClass="int" keyProperty="fileId">			select SQ_REF_FILE_ID.nextval as FILE_ID from dual	  </selectKey>		insert into TEST_FILE (FILE_ID,FILE_TYPE,FILE_NAME,FILE_SIZE,FILE_DATA)		values (#fileId#, #fileType:VARCHAR#, #fileName#, #fileSize#,#fileData#)	</insert>			</sqlMap>    

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.