09-03-2008 08:37 AM
Our LabVIEW application has to save jpeg-images into a MS-SQL database as binary data.
We use the database connectivity toolkit (LV8.5).
The image can not saved direcly using SQL, a stored procedure hat to be used. One of the parameter is "@data" with datatype "binary". In Principle eeverythiong works but: We open the jpeg-file as binary (string) and use that data to send to the database.
BUT:
No we've seen, that LabVIEW (the db-toolkit) adds 4 characters at the beginning of the binary data.
LabVIEW can remove this 4 character when we read the file, but: other applications (non LabVIEW) do not know about this 4 leading characters --> corrupt data.
How can we save the binary "string" /image data directly without LabVIEW is changing the data when writing it into the db?
Due the access with other applications we have to write directly the binary data (no LabVIEW-Cluster, Array, etc.)
09-03-2008 08:48 AM
Hi zav,
it sounds like you first write this file as binary data. If you do it, then connect a false constant to the top right input. LabVIEW can store some additional information to the file, which you in this case don´t need.
If not, which functions do you use??
Hope it helps.
Mike
09-03-2008 08:54 AM
Zav,
i haven't saved any images as binary data in databases yet, so i cannot tell you if this is the reason for the four byts you are seeing.
But if you save an array in a binary file, LV adds 4 bytes in the beginning in order to store the size of the array. I think that this is done in your database as well....
For the files, you can disable this prepending with a boolean parameter at the "write to binary file". I don't know if this is available in the database connectivity toolkit...
hope this helps,
Norbert
09-03-2008 09:05 AM - edited 09-03-2008 09:14 AM
The 4 characters are added by the toolkit (C:\Program Files\National Instruments\LabVIEW 8.5\vi.lib\addons\database\Command.llb\Cmd Set Parameter Value (C).vi), see attachement. I do not want to modify the toolkit...
We directly binary-read from a given jpg-file (without touching the data) and connect the (binary-)string-output to the input of toolkit-vi: "Cmd Set Parameter Value.vi".
How can we directly write binary data without having the modification in the binary data?
09-03-2008 09:32 AM
09-09-2008 06:00 AM
09-09-2008 07:00 AM
zav wrote:
but the LabVIEW-DB-Toolkit should allow - in our example - store unmodified binary data that other applications can access it.
You might wish to visit the Product Suggestion Center.
I assume that you have version 1.0.1 of the DB toolkit which is several years old, but NI released a new version with 8.6. I have no idea if it includes this functionality or not, but even if not, you can create it by writing code which will be parallel to the toolkit. Maybe not the best solution, but it works.
12-01-2008 04:30 PM
Any updates on this problem?
I'm running into the same situation (using DB toolkit for LV8.6) and am wondering whether anyone has any other ideas?
08-19-2010 05:23 AM
I have a different problem. I also use stored procedures and I cannot upload binary files larger than 8 kilobyte which is a bit small for PNG images and waveforms 😕
I am using labview 8.6.1 and teststand 4.2
06-15-2011 02:09 PM
I am having the same problem.
Please see image attached. This code works well to save the binary file to sql(database toolkit not shown here) but I can't read the binary file in Crystal reports.
I have a VB.NET program that saves binary into sql and crystal reports reads it no problem.
Has anyone reach a solution on this?
Thanks