Problem solve Get help with specific problems with your technologies, process and projects.

Get file from SQL database to Notes document

How can I get a file that is stored in a SQL database (Blob) to a Notes document?

Great timing!!! We just finished a project doing this exact thing earlier this week. Unfortunately, it's not that easy, nor straightforward to do. You can use the LC (or LEI) LSX to access the SQL table, get the column into an LCField object, and then store the contents to disk.

Here's some sample code:

myBlob = "C:\temp\tempfile.doc"
Open myBlob For Binary As #1
Put #1 ,, lcField2.value(0)
Close #1
' now attach to the appropriate Notes document using a LotusScript
RichTextItem EmbededObject

This example assumes the file, based on the extension, is a Word document and the filename does not really matter. Hopefully the SQL row will contain this information for you in one or more other fields, since I'm not sure if you can get that information from the attachment without [painfully] canning the binary contents of the file. In our case, we used a COM object that was written in Visual Basic to get the file from the BLOB column. The COM object was written to also convert the file from its native MS Word format to HTML using the Word-to-HTML conversion feature in MS Word 2000. Pretty slick, but it might be overkill for your needs.

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...