I am using following code to retrieve a file from database from a BLOB column. I am able to retrieve the file and save in c:\temp directory, but VBA adds some junk characters at start of file making some files like jpg images un-readable. Can anyone tell whats wrong with the code or or do I need to use some other driver for connection etc...
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim myStreaM As New ADODB.Stream
'String used for connecting to DB
ProdConnectString = "provider=msdaora.1;user id=user;password=psd;data source = ds;option=1+2+8+32+2048+16384"
Set conn = New ADODB.Connection
conn.ConnectionString = ProdConnectString
conn.CursorLocation = adUseClient
rs.Open "select file_data from TABLE where NAME ='ABCD.txt'", conn
myStreaM.SaveToFile "c:\temp\XYZ.txt" , adSaveCreateOverWrite
File example (first 2 characters are junk, same characters are repeated in all files):