Need example of LCStream to read ODBC BLOB into Notes

I’m trying to copy a file from MySQL to a Notes document. I’ve searched the forum and found out that I need to use LCStream to detach and then reattach the file, but I can’t find a code example.

A code sample is worth a thousand words!

Thanks

Subject: Need example of LCStream to read ODBC BLOB into Notes

Will your code be running on a Win32 platform?

If so, you may want to shy away from LCLSX for blob handling…many of us have had problems with blobs and the connectors.

Instead, take a look at http://www-10.lotus.com/ldd/nd6forum.nsf/ShowMyTopicsAllFlatweb/c1dd17431b3b8993852571da006f872e?OpenDocument and see how you can use MS’ ADO.DB to get the job done.

Subject: RE: Need example of LCStream to read ODBC BLOB into Notes

I’m not familiar with ADO - two questions;1) can it connect to a MySQL database?

  1. what software do I need to install to get the ADO tools on Win32?

Thanks for your help

Subject: RE: Need example of LCStream to read ODBC BLOB into Notes

You probably don’t need to install anything for this to work.

If you look at the link I gave there is a line

Call cn.Open(“Provider=SQLOLEDB;data Source=UKLONDMEYPCRAU1\UATSSPOW;Initial Catalog=Credentials;User Id=readonly;Password=readonly”)

That is the connection string for an OLEDB MS SQL Server connection, you would want to use the OLEDB for ODBC to connect to your previously defined MySQL ODBC DSN…it would look something like this instead:

Call cn.Open(“Provider=MSDASQL;PersistSecurityInfo=False;User Id=USERID;Password=PASSWORD;Data Source=MyDSN;catalog=MyDatabase;”)

You can learn more about ADODB at ADO Programmer's Guide - ActiveX Data Objects (ADO) | Microsoft Learn

Subject: RE: Need example of LCStream to read ODBC BLOB into Notes

Okay, I’m connecting to MySQL and retrieving the field that is storing a PDF file. The problem is that the data is corrupt when I write the local file.The files that I’m retrieving are much smaller than the ones you were working with, typically less than 10KB.

Also, you are using adBlockSize as a constant and then BlockSize in your sub. Are these meant to be different, or is BlockSize meant to be adBlockSize?

If I can get this to work, it is indeed much better than the LCLSX Stream method.

Thanks for your help

Subject: RE: Need example of LCStream to read ODBC BLOB into Notes

Good stuff! Thanks for the code example and detailed answers to my questions. I’ll give it a try.