Hi Eric.
I usually open an InputStream on the field in question, and read/write that. I
apologize for not have any current examples available...
For example, to write to a BLOB, or other large field;
byte[] content = someData;
PreparedStatement ps;
ps = conn.prepareStatement(STORE_CONTENT_SQL);
ps.setBinaryStream(STORE_CONTENT_FILE, new ByteArrayInputStream(content),
content.length );
ps.executeUpdate();
JDBC drivers get to worry about how to actually write the data to the database, not I.
-Steve
Eric Kaplan wrote:
> Speaking of BLOBs...
> We are using BMP and are storing the standard Date, Integer, Double, String.
> We also store serialized objects, but have resorted to storing them on the
> filesystem
> because when we looked into storing them in the database, it seemed as if
> Oracle
> required very specific, non-standard code to store and retrieve, and our
> code needs
> to be database agnostic. Does anyone have any database neutral code for
> storing/
> retrieving blobs?
>
> Regards
>
> Eric
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of James
> Higginbotham
> Sent: Monday, May 13, 2002 5:52 PM
> To: Dain Sundstrom
> Cc: Stefan Damian; [EMAIL PROTECTED]
> Subject: RE: [JBoss-user] BLOB type in a CMP
>
>
> Right.. We have a script that creates the tables ahead of time per the
> targeted DB for our project. So, I just made sure that Jboss doesn't
> delete or create and all is well. BLOB in MySQL is limited to 64k, which
> isn't enough for serializing most useful classes. So, LONGBLOB works
> better. This could be a change in the default mapping if everyone
> thought it was worth it in the MySQL case - since 64k *may not* be all
> that useful for a BLOB column.
>
> James
>
>
>>-----Original Message-----
>>From: Dain Sundstrom [mailto:[EMAIL PROTECTED]]
>>Sent: Monday, May 13, 2002 4:11 PM
>>To: James Higginbotham
>>Cc: Stefan Damian; [EMAIL PROTECTED]
>>Subject: Re: [JBoss-user] BLOB type in a CMP
>>
>>
>>Is BLOB the wrong mapping? We shoot for 80% on these
>>mappings, meaning
>>we try to make 80% of the users happy. I can change it
>>LONGBLOB or put
>>a comment in like some of the other mappings.
>>
>>BTW, you can always override the default mapping for a single
>>field, or
>>just create your own private mapping (that is what I do for
>>my projects).
>>
>>-dain
>>
>>James Higginbotham wrote:
>>
>>
>>>Everything worked for me on JBoss 3.0 (the work was
>>>
>>originally done on
>>
>>>2.4 and ported to 3.0 I think - I inherited the work) using
>>>
>>the following:
>>
>>>
>>>
>>> <cmp-field>
>>> <field-name>data</field-name>
>>> <column-name>data</column-name>
>>> <jdbc-type>JAVA_OBJECT</jdbc-type>
>>> <sql-type>BLOB</sql-type>
>>> </cmp-field>
>>>
>>>and creating the table ahead of time, rather than allowing jboss to
>>>create it using a LONGBLOB. Jboss will only create a BLOB type by
>>>default and thus limit the size of the blob storage, so
>>>
>>make sure to:
>>
>>>
>>>
>>> <create-table>false</create-table>
>>> <remove-table>false</remove-table>
>>>
>>>HTH,
>>>
>>>James
>>>
>>> -----Original Message-----
>>> From: Stefan Damian [mailto:[EMAIL PROTECTED]]
>>> Sent: Tuesday, May 07, 2002 4:43 PM
>>> To: [EMAIL PROTECTED]
>>> Subject: [JBoss-user] BLOB type in a CMP
>>>
>>> Hello,
>>>
>>> I use MySQL and jBoss 2.4
>>>
>>> I want to store binary data in database greater then 2k and the
>>> programming interface is a CMP.
>>>
>>> For data less then 2k it's work very fine with data
>>>
>>type = Object
>>
>>> and jaws mapping like:
>>>
>>> java.lang.Object
>>>
>>> JAVA_OBJECT
>>>
>>> BLOB
>>>
>>> Can define someone a real hint or an advice?
>>>
>>> Stefan
>>>
>>>
>>
>>--
>>xxxxxxxxxxxxxxxxxxxxxxxxx
>>Dain Sundstrom
>>Chief Architect, JBossCMP
>>JBoss Group, LLC
>>xxxxxxxxxxxxxxxxxxxxxxxxx
>>
>>
>>
>>
>
> _______________________________________________________________
>
> Have big pipes? SourceForge.net is looking for download mirrors. We supply
> the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
>
>
> _______________________________________________________________
>
> Have big pipes? SourceForge.net is looking for download mirrors. We supply
> the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
>
>
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user