[AccessD] Opening Files from BLOB in SQL Server 2012

Jurgen Welz jwelz at hotmail.com
Fri Oct 30 11:31:16 CDT 2015


I haven't had much luck with this issue yet.  The .FieldSize property of the recordset data field containing the blob used by the GetChunk reports one size, being the actual source file size, but the variable containing the retrieved 'Chunk' has a string length 1/2 the size even when told to pull the entire FieldSize.  I also know that if I have a large file, it does not run out of data as it pulls each additional chunk.  It just returns 1/2 the data to the interim  variable being written to the file system.

I'm now testing with a small text file stored in blob and none of the characters survives the GetChunk method so it's looking like each character is somehow truncated.

J

________________________________________
From: AccessD <accessd-bounces at databaseadvisors.com> on behalf of James Button <jamesbutton at blueyonder.co.uk>
Sent: October 30, 2015 9:18 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Opening Files from BLOB in SQL Server 2012

AFAIK
The data within (almost) all apps files is not effected by the 32 or 64 bitness
of the OS or App.
HOWEVER
The bitness of the app may matter is there are DLL's or similar components used
from common libraries.
E.G. Don't expect add-ins for Excel, or compiled scripting modules to work with
both 64 and 32 bit versions.
Mostly any app used to open a BLOB will be run within it's own 'environment area
within the windows OS.

JimB

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jurgen
Welz
Sent: Friday, October 30, 2015 1:54 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Opening Files from BLOB in SQL Server 2012

I pretty much used the sample code at the link.  The relevant line read:

 Open Destination For Binary As DestFile

The Blobs are created by what I assume is a 64 bit accounting package and we are
using our internally developed project management software to be able to provide
broader access to some of the data stored by this system.
I guess I'm going to have to look at the file written by Access 2013 with a hex
editor and compare with the original file written to the blob by the other
application.  I expect I'm going to have to OR each 32 bits with a 64 bit buffer
and write that result.  Time for Google.

Jurgen Welz
Edmonton Alberta


________________________________________
From: AccessD <accessd-bounces at databaseadvisors.com> on behalf of Stuart
McLachlan <stuart at lexacorp.com.pg>
Sent: October 29, 2015 5:18 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Opening Files from BLOB in SQL Server 2012

How are you writing the files?

i.e. Are you doing an OPEN.... FOR OUTPUT...
or OPEN... FOR BINARY...

It sounds like the write process is trying to convert Wide Characters to ASCII.
Make sure that you are opening for BINARY

(If the code was for 97 and earlier, it would have text stored as ASCII so you
would not have
the Wide -> ASCII conversion concerns)



On 29 Oct 2015 at 23:03, Jurgen Welz wrote:

> I'm attempting to access files of various types stored by an
> accounting application.  I've found an old knowledge base article
> applicable to Access versions 1 though 97:
> https://support.microsoft.com/en-us/kb/103257
>
> I'm using an ODBC connection because that's what we have been using
> universally and it remains solid.  It works to read the file data from
> the database column because the binary data I'm pulling matches the
> file size of the item stored.  The problem I'm having is when I write
> the file to disk, it is showing up with exactly 1/2 the size.  It is
> like I'm writing a 32 bit file into a 16 bit file system.  Attempts to
> open the files written to the file system result in a report that the
> file is damaged or corrupt.
>
> If, for example, I've got a file made of 10 chunks 100 bytes long plus
> 30 bytes, as the file is written and the first 30 bytes is added to
> the file, it reports as size of 15 bytes and an additional 50 bytes as
> each additional chunk is appended to the file.
>
> Does anyone have a suggestion as to how I might store and or just open
> these files.  File types are Office documents, various image types,
> pdfs, msg or any number of other file types for which we generally
> have applications. We are running Windows Server 2012 R2 64 bit and
> Office 32 bit.
>
> Jurgen Welz
> Edmonton, AB


More information about the AccessD mailing list