LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to insert 2 dimensions array to SQL database and playback?

i want to insert some 2 dimensions array to SQL and playback, i can insert but nothing to playback. i set the type as binary in SQL that also as image type. so i think that's no problem , i look through some labview software with examples.there are no show insert 2 dimensions array to database and reading. i used labview data connectivity toolkit and labview8.2.
0 Kudos
Message 1 of 5
(3,753 Views)


@guqunlin wrote:
i want to insert some 2 dimensions array to SQL and playback, i can insert but nothing to playback. i set the type as binary in SQL that also as image type. so i think that's no problem , i look through some labview software with examples.there are no show insert 2 dimensions array to database and reading. i used labview data connectivity toolkit and labview8.2.


This is bound to create troubles. Binary data is a bit of tricky with SQL and can depend on the actual SQL backend you use both in what and if it can do it as well as in the SQL syntax to use to format binary data. An extra difficulty in your case would be that you would need to store also the two dimensions somehow in order to be able to reconstruct the data later on.

In order to make sure the dimensions are taken care of you could first Flatten your array to a string and later using Unflatten get it back into an array. Then to get it in the database you might have to format the binary string coming from the Flatten to String function in some sort of hexadecimal string, and do the reverse when retrieving the data later. The exact format of this can change between SQL databases!

I do not really know how the Database Connectivity Toolkit would deal with this directly or if it can at all, using my own ODBC API with support for extraction of native LabVIEW data types directly most of the time, but storing binary data in a database is usually not a good idea since most databases were not designed for that purpose and therefore usually suffer very poor performance for them.

Rolf Kalbermatter

Message Edited by rolfk on 01-18-2007 12:07 PM

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 5
(3,749 Views)

In general, if you want to insert a 2D array into a database using the Database COnn Toolkit, you need to auto index the array using a for loop so you need to insert 1 D arrays into the Insert Data Function.

 

I hope this helps

0 Kudos
Message 3 of 5
(3,739 Views)

Another point: This function does not accept arrays you need to convert from array to a cluster and wire the cluster into the Insert Data Array.

 

Sorry

0 Kudos
Message 4 of 5
(3,737 Views)

One other possibility which I have used for large binary data sets (In my case large picture data) was to store the data in a seperate file using the write binary to file and I kept all these files in a central location, then I simply stored the reference to the data file in the DB.  This might not be the best way but it worked.  disclaimer: I am no DB expert.  Hope this helps.

Paul F 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 5 of 5
(3,731 Views)