LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Database Connectivity

Hello,

I want to input in a databas table the results of voltage measurements with M6012 card. Because the signal is Array, text "Binary data" appears in the table. How do I read the measurement result (voltage) and input it into the table?
Regards,
Djordje
0 Kudos
Message 1 of 6
(3,666 Views)
Hi:
 
You don't tell us what method are U using for writing to the Database Table, and which Database are you using. It would be easier to help you if you could provide more information, for example a screenshot of the VI or even the VI itself. Watching the code helps a lot. Also check out what is the data type of the field in the table, for you to supply the right one to it.


Robst - CLD

Using LabVIEW since version 7.0


0 Kudos
Message 2 of 6
(3,657 Views)
Hello,

In the case that I am using MS ACCESS table, if the last (fifth) colon is declared as a type OLE OBJECT in the table message "Long binary data" appears. But I need the number coresponding to the measured voltage in the fields of the table. How can I read this "Long binary data" or convert this into data representing the voltage value.

Another question. If I am using MySQL table, OLE OBJECT type does not exist. Which field type do I use in this case, if I want to insert a MySQL table number corresponding to the measured voltage.

Many thanks.

Message Edited by Jaka on 04-15-2006 05:04 AM

0 Kudos
Message 3 of 6
(3,643 Views)

You cannot insert an array into a table whose other fields are simple strings, etc. You can do two things. Create a new table with a join to the original table where the voltage will be inserted, or insert each element in the array one by one by using a for loop with auto indexing.

 

Hope this helps

0 Kudos
Message 4 of 6
(3,600 Views)
i never tried to enter such large data myself, but see if this works, using "flattern string" converting the array to a string and write it to the table (of course, you may need to adjust the colum type), use "unflattern string" after reading it from the table.

-Joe
0 Kudos
Message 5 of 6
(3,591 Views)

Most database management systems don't recognize the data type of an "array".  So what you have to do is either use a binary field (called OLE Object in Access, BLOB in Oracle, etc) or you have to write one element of the array at a time to a field of that data type (numeric in this case).  The second method is very slow, but since it uses the simple data type of the database, you can then often do operations on it.  If it's a binary field (not unlike saving data to a binary file), it's a lot faster, but you need to know exactly what the format of the data is in order to read it out and operate on it later. 

If you use the Database Connectivity Toolkit with LabVIEW, it will automatically flatten arrays to string, create a binary field, and write the binary data to it.  To read that data back into LabVIEW, you use the Database Variant To Data function and describe the type as what it was originally - probably a 1D array of DBL.  If you are using other software to write and read the data to the table, you need to pay close attention to how that data is converted to and from the array in order to get it back.

Data type conversions can be very tricky between any app and a database.  I know I didn't specifically address your questions, but I hope you better understand the situation now. 

 

0 Kudos
Message 6 of 6
(3,567 Views)