LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DataBase For CompacRIO

Hi, I need to make a database in CompactRIO but the system which uses is Linux so many libraries like SQL server, SQLite and others aren't compatible. Also if I made a file with format .dll to call it in CompactRIO it will be a problem, because .dll only works for Windows and I would have to install a emulator inside of CompactRIO to achieve that (I don't know if it is possible to do that).

 

I need a advice to make a database in CompactRIO and it behaviour would be like a datalogger, due to CompactRIO would be working and once in a while a person will take out the device, connect it in a computer or a screen and see the data that saved all the time that was working

 

 

0 Kudos
Message 1 of 8
(3,324 Views)

If you are looking specifically for datalogging there is always the option of storing TDMS files either on the cRIO flash or on an attached USB drive (even easier to retrieve the TDMS files without disconnecting the device). Logging data with the cRIO to TDMS is so common that NI has many, many tutorials for how to do this. If you are interested start here.

0 Kudos
Message 2 of 8
(3,308 Views)

What is the difference between TDMS file and Database? I mean, what are the pros and cons?

0 Kudos
Message 3 of 8
(3,299 Views)

TDMS files are basically proprietary data files that store data measurement values and other metadata. It has a hierarchical structure. You can read more about it here.

 

The key thing to think about is how is the customer going to read the data once retrieved from the cRIO. NI provides a TDMS plugin for Excel which allows Excel to open TDMS files and parse their contents but this requires that whoever is reading the files has this plugin installed. LabVIEW, obviously, supports reading TDMS files natively as well.

 

If you need to support other mechanisms of reading data (say to expose over other services) then TDMS may not be suitable. You need to think carefully about who will use the data and how - that will point you to the right solution.

0 Kudos
Message 4 of 8
(3,296 Views)

To run a code made in C or C++ on Linux Real Time (cRIO 9036), I must do it using shared libraries? Could I do it using other method? If there is other method, please let me know because I have read many documents and it only uses shared libraries, in which case I will need to have access to the Internet or a communication to the device which has the code and the idea  is the cRIO can run that code 

0 Kudos
Message 5 of 8
(3,294 Views)

 Why use TMDS to create a database in cRIO and not sqlserver or others?

0 Kudos
Message 6 of 8
(3,308 Views)

The cRIO doesn't support database access because it requires ActiveX (Only available in Windows, the cRIO has a Linux distribution).

But you could use the cRIO to modify a database running on a hostPC.

This may be useful: Native LabVIEW TCP/IP Connector for mySQL Database

 

Best regards,

 

 

Kudos are welcome Smiley Wink 

Kudos are welcome 😉 marked solutions are awesome!
0 Kudos
Message 7 of 8
(3,276 Views)

@gomezramones wrote:

To run a code made in C or C++ on Linux Real Time (cRIO 9036), I must do it using shared libraries? Could I do it using other method? If there is other method, please let me know because I have read many documents and it only uses shared libraries, in which case I will need to have access to the Internet or a communication to the device which has the code and the idea  is the cRIO can run that code 


Well if you have C(++) code that you want to leverage off for use in LabVIEW, then yes shared libraries are the only option for you. And you will likely have to recompile the code for use on the cRIO using the C compiler that NI distributes to make sure the shared library is using the correct C runtime library versions and code generation method (some cRIO run an ARM CPU that your typical Linux precompiled shared libraries definitely won't run on). Even if you use a x64 based cRIO (the higher end models) and you have an x64 pre-compiled shared library for your Linux desktop system, it is very likely that it was created with a very different version of the GCC compiler that does not generate shared libraries linking to the right Gnu C runtime library versions used on the NI Linux Realtime system.

 

There are toolkits around that use the SQLite engine to implement a local database on the cRIO. If you want to interface to a server based SQL database from a cRIO things get a lot more complicated. Almost all the options to do that will not run on a non-Windows system, including all the ADO/DAO or .Net based interface libraries, since they use ActiveX or .Net to do there magic and that is not available under a Linux system (in fact under no system other than Windows).

 

The mySQL library mentioned by Hector is probably the closest to a working library that has any change to work without to much trouble. But it is specifically for a mySQL server (and also MariaDB as that is basically the followup project for mySQL).

SQL Server as much as it is sought after is a lot more complicated. There is a project written in C called FreeTDS. It implements the  SQL server TDS protocol which is unfortunately undocumented safe of an old document that describes the protocol before Microsoft licensed the database code from Sybase and then implemented its own version as SQL Server.

 

FreeTDS has reverse engineered many of the recent protocol additions but doesn't quite implement everything that the most recent SQL Server version supports. For simple queries and updates however it does work. You can either create a LabVIEW interface to call into the unixODBC API that then uses the FreeTDS ODBC provider or you can also directly interface the FreeTDS shared library. Both will require substantial Call Library Node development to get anything reasonable working.

With the unfinished documentation from what the FreeTDS team reverse engineerd about the TDS protocol it would also be possible to write directly a TDS driver in native LabVIEW using the TCP/IP nodes, but to my knowledge nobody ever has seriously attempted this.

Rolf Kalbermatter
My Blog
Message 8 of 8
(3,249 Views)