Accessing DB2 Blob data stored on an iSeries (AS/400)

I have a developer who can routinely access DB2 data on our iSeries with his Notes application.However he doesn’t seem to be able to access blob data.

This program was how the DB2 data was initially propagated:

Subject: Accessing DB2 Blob data stored on an iSeries (AS/400)

Will this answer your question?

http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/a45d72f1a493240c85256bb50066144c?OpenDocument

Subject: RE: Accessing DB2 Blob data stored on an iSeries (AS/400)

The view shows 4 columns: Modified, MyChar, Blob Len, MyBlob. the first three look ok. However the contents of MyBlob seem to match MyChar.

This is the code that our developer has:

Agent: Get Blob File

(Options):

Option Public

Option Declare

Uselsx “*LSXODBC”

Initialize:

Sub Initialize

Dim  session As New notessession

Dim  conn As New ODBCconnection

Dim  query As New ODBCQuery

Dim result As New ODBCResultSet

Dim db As NotesDatabase

Dim Doc As notesdocument

Dim Item As NotesRichTextItem



Set db = session.CurrentDatabase



If conn.connectto("my400", "userid", "password") Then

	Set query.connection=conn

	query.sql="Select MyChar, Length(MyBlob) as MyBlobLen, MyBlob from rob.TestBlob order by MyChar"

	Set result.query=query

	

	If result.Execute Then

		If result.isresultsetavailable Then

			Do

				Set doc=New NotesDocument(db)

				result.nextrow

				Doc.Form="BlobTest"

				Doc.MyChar=result.getvalue("MyChar","")

				Doc.MyBlobLen=result.getvalue("MyBlobLen",0)

				Set Item=New NotesRichTextItem(Doc, "MyBlob")

				item.AppendText result.getvalue("MyBlob","")

				Doc.MyBlobText=Item.text

				Doc.SQL=Query.SQL

				Call Doc.Save(True,False)

			Loop Until result.isendofdata

		End If

	End If			

	result.Close(DB_CLOSE)

	conn.Disconnect

End If

End Sub

Subject: RE: Accessing DB2 Blob data stored on an iSeries (AS/400)

I’ve never used LS:DO to access BLOB data. I used LSXLC.If you open the document, does the content of MyBlob get downloaded/stored/displayed correctly?

Subject: RE: Accessing DB2 Blob data stored on an iSeries (AS/400)

I’ve never used LS:DO to access BLOB data. I used LSXLC.If you open the document, does the content of MyBlob get downloaded/stored/displayed correctly?

Subject: RE: Accessing DB2 Blob data stored on an iSeries (AS/400)

No, the contents of the MyBlob field in the notes document is the same as MyText.

Subject: RE: Accessing DB2 Blob data stored on an iSeries (AS/400)

What is MyText? I didn’t see any reference to MyText in your code. Maybe I missed something…?

By the way - in your code, you use ‘AppendText’ method to put the BLOB data to the RT Item. This method only deals with text. You’d want to look at the EmbedObject method.

Subject: RE: Accessing DB2 Blob data stored on an iSeries (AS/400)

Looking at that.