|
I have been experimenting with BLOBs and have finally had some success. One of
my problems was the manner in which I was trying to load the BLOB. This is
what I was doing (from an interactive SQL session) -
CREATE TABLE LIB/BLOBS1 (FILE_BLOB BLOB (100000 ) WITH DEFAULT
NULL, NAME CHAR ( 10) NOT NULL WITH DEFAULT)
INSERT INTO LIB/BLOBS1 (FILE_BLOB, NAME)
VALUES(blob('picture.jpeg'), 'picture')
However, the java example that I found would not display the image. I then
loaded the blob using JDBC (another example I found) and it the java example
displays the image. This is how the JDBC example loaded the blob -
pstmt = con.prepareStatement(
"INSERT INTO lib.blobs1 VALUES( ?, ? )" );
for (int i = 0; i < asName.length; i++)
{
pstmt.setString( 1, asName[i] );
fImage = new File( asImages[i] );
isImage = new FileInputStream( fImage );
pstmt.setBinaryStream( 2,
isImage, (int)( fImage.length() ) );
iRowCount +=
pstmt.executeUpdate();
}
I am now searching to see if the blob can be loaded using RPG (embedded SQL, I
guess). Does anyone know if this is possible?
Thanks,
Joe
p.s. This is the example I used -
http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/exercises/BLOBGet/
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.