|
Joe, You can do this in RPG. Here is an example: d binimage s SQLTYPE(BLOB_FILE) * c eval binimage_fo = SQFRD c eval binimage_name = 'picture.jpeg' c eval binimage_nl = %len(%trim(binimage_name)) C/exec sql C+ INSERT INTO LIB/BLOBS1 (FILE_BLOB, NAME) VALUES(:binimage, 'PICTURE') C/end-exec SEU will not like the SQLTYPE declaration. However, the SQL precompiler will make it able to compile. Thanks, Schadd Gray Damon Technologies, Inc. www.damontech.com ----- Original Message ----- From: "Joe Wells" <jwells@xxxxxxxxx> To: <rpg400-l@xxxxxxxxxxxx> Sent: Friday, May 14, 2004 9:35 AM Subject: I have been experimenting with BLOBs and have finally had somesuccess. One of my problems was the éT¨ÂªÆT > 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/ > > > > _______________________________________________ > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l > or email: RPG400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. > >
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.