LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to upload large binary data to dB so it can be read by any app?

Hi everyone,

Short version: how do you upload binary data into a MySQL blob field in such a way that it can be read by any application?

Long version:

I've been struggling with the problem of putting files into database BLOB fields. (MySQL and Database Connectivity Toolkit).

I was initially building a query string and executing the query but was finding that certain binary characters were causing failures (end of string terminators, etc...) So, a working solution was to encode the binary string, and that worked fine, although bloated the dB a fair bit. I could decode in LabVIEW and then save the file as needed.

Now, the customer wants to be able to save the files using other apps, including the MySQL Query Browser, so an encoded file is no good.

I found using a parametrized query allows me to put the unencoded string into the dB, but it appends a 4-byte length at the front of the BLOB before it inserts it into the dB. Some apps ignore these 4-bytes (such as .pdf) but most do not.

A related thread on NI discussion forums: http://forums.ni.com/ni/board/message?boar...ssage.id=354361 has no solution, and my support ticket at NI has been ongoing without answer for a while.

Thanks,
Ben
0 Kudos
Message 1 of 3
(3,822 Views)

The problem is the DCT. Using ADO it is fairly easy to insert binary data into a BLOB field. I have not tried it in MySQL, but it works fine in SQL Server, Oracle, Firebird and other free/open source databases I have tried. To get you started, see this thread.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 3
(3,797 Views)

Just a quick note :
When working with binary files between applications be sure to check endianess.

You will get some weird errors or unwanted data manipulation if an application is expecting big endian and gets little endian or visa versa

Cory K
0 Kudos
Message 3 of 3
(3,792 Views)