You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Pandey <vi...@gmail.com> on 2007/04/06 23:51:40 UTC

Re: Data size bigger than max size for this type

I'm facing the same issue with apache-activemq-4.1.0 right now.
I have faced something simillar earlier.
looks like it's coded in Oracle driver to accept nothing greater than 4K as
a blob/byte[]/clob/char[]

below is how i fixed it (came across the solution somewhere i guess) : 

					// create an empty blob and execute the statement ... do retain the
identifier for the row
					oracle.sql.BLOB blob = oracle.sql.BLOB.empty_lob();
					ps.setBlob(4, blob);
					ps.execute();


					//use the identifier retained above to get the handle to the empty blob         
and write the blobData (>4k)
					PreparedStatement st =
connection.prepareStatement(getBlobHandleForOracleQuery);
					st.setInt(1, rowID);
					
					ResultSet rs = st.executeQuery();
					rs.next();
					blob = (oracle.sql.BLOB)rs.getBlob(1);
					OutputStream os = blob.getBinaryOutputStream();
					try {
						os.write(blobData);
						os.flush();
						os.close();
					} catch (IOException e) {
						e.printStackTrace();
						throw new SQLException("Error in writing BLOB data :
"+e.getMessage());
					}
					

This happens only with oracle (far as i'v seen .. sybase and mysql are good
with bigger data as well).

Regards
Vipul



James.Strachan wrote:
> 
> On 3/30/07, ron55test <rk...@gmail.com> wrote:
>>
>> The column is of type blob.
>> This is what the table structure is as created by activemq:
>>   CREATE TABLE ACTIVEMQ_MSGS"
>>    (    "ID" NUMBER(32,0) NOT NULL ENABLE,
>>         "CONTAINER" VARCHAR2(250),
>>         "MSGID_PROD" VARCHAR2(250),
>>         "MSGID_SEQ" NUMBER(32,0),
>>         "EXPIRATION" NUMBER,
>>         "MSG" BLOB,
>>          PRIMARY KEY ("ID")
>> )
> 
> It looks like the BLOB type is 4Gb long
> http://www.ss64.com/orasyntax/datatypes.html
> 
> so I'm not sure thats the problem. I suspect it may be due to the  way
> in which the JDBC code works with the BLOB column type. This article
> appears to suggest that the preferred way to work with Oracle BLOBs is
> using the Blob type
> http://www.onjava.com/lpt/a/1370
> 
> so I've patched trunk of the Oracle adapter to use this approach
> instead. Any chance you could build trunk and see if this fixes your
> issue?
> 
> I've raised this issue to track the issue
> http://issues.apache.org/activemq/browse/AMQ-1216
> 
> -- 
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> 

-- 
View this message in context: http://www.nabble.com/Data-size-bigger-than-max-size-for-this-type-tf3489299s2354.html#a9878741
Sent from the ActiveMQ - User mailing list archive at Nabble.com.