LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connect to SQL Server from cRIO with NI Linux Real-Time

hello

 

We’re looking for a LabVIEW toolkit that can read and write to an SQL server database.

The database is running on a windows server in the network of our customer. Our LabVIEW application is running on a NI cRIO 9034 with a NI Linux Real-Time OS.

  • The LabVIEW Databse Connectivity Toolkit is not running on the NI Linux RT
  • Found Raima Database API for LabVIEW. But on the NI-homepage is wirtten « support for NI Linux Real-Time coming soon » (Waiting for answer from Raima support)

Is there a possibilty to connect to a SQL server from a NI Linux RT?

Has someone a related problem?

 

Thank you for answering my questions.

 

Kind regards

 

Lukas

0 Kudos
Message 1 of 12
(4,843 Views)

Not sure what Raima is up to there. There are a few possibilities besides waiting for Raima to finish their Toolkit.

 

1) Microsoft nowadays supports SQL Server on Linux. Which of the many 100 distributions might be still a challenge. Howerver this is the SQL server running on the Linux system and only for x64 Linux distributions. So it will maybe work for the x64 based cRIOs, but definitely not for the ARM based low cost variants. I say maybe since the MS ODBC driver will only work with specific versions of the 64-bit UnixODBC 2.3.0 Driver Manager, which might not be readily available from the download site NI uses to install additional packages.

 

2) Another variant is to download the FreeTDS sources and compile your own ODBC manager for the cRIO target. That would likely work for all cRIO targets except the PPC ones, but is a pretty cumbersome thing to do, since FreeTDS is not likely to just compile out of the box for the cRIO platform.

 

3) Last but not least, the FreeTDS project has documented the TDS protocol to some extend. It is based on an old official document from Sybase that documents the 4.2 version of the protocol and additional implementations that implement the various flavors of the 7.x protocol that recent versions of SQL Server are using. It would be possible to implement that protocol entirely on top of the LabVIEW TCP nodes. That would be the most flexible solution and at the same time also the most extensive if terms of workload.  

 

Rolf Kalbermatter
My Blog
Message 2 of 12
(4,815 Views)

Thank you for the fast answer

 

I've got an answer from Raima to:

"Thank you Lukas for your question and sorry for any confusion.  Yes the Raima DB API for Labview supports the NI Linux RT platform.   

 

With the ODBC compliance of our product you should be able to connect to an existing SQL Server db. "

 

I will get a cRIO for tests tomorrow and will test the free trial version from Raima first.
Otherwise i will test your helpfull solutions

 

Thank you

Kind regards

0 Kudos
Message 3 of 12
(4,781 Views)

There may lay some potential problems with this. ODBC while in theory a standard, suffers of one big problem: It grew over the time so complicated that nobody really grasps all the difficulties, version differences, backwards and forwards compatibilities and what else anymore. So the ODBC Driver for Linux from MS for SQL Server has some very specific requirements. It only is available for Linux x64 platforms, requires 64-bit UnixODBC 2.3.0 Driver Manager, built for 64-bit SQLLEN/SQLULEN. Otherwise it won't work. That's a pretty strict requirement.

 

Traditionally there have been two ODBC manager implementations for Unix one was called unixODBC and the other was called libiODBC. unixODBC is currently the defacto standard for Linux since most Linux distributions provide it. Both projects had phases of more and sometimes less to no activity over the last 20 years, but can be considered fairly full featured nowadays.

 

As to ODBC drivers for SQL Server for Linux unless you go to compile your own driver from the FreeTDS sources you will need to use an x64 cRIO for sure. There are two other solutions besides the driver from Microsoft itself, one is from DevArt and the other from EasySoft. They are both not for free. If you plan on using FreeTDS you should be familiar with compiling your own software with gcc, and should know quite a bit more than just invoking make and make install on the command line. Smiley Happy

Rolf Kalbermatter
My Blog
Message 4 of 12
(4,770 Views)

"Thank you Lukas for your question and sorry for any confusion.  Yes the Raima DB API for Labview supports the NI Linux RT platform.   

With the ODBC compliance of our product you should be able to connect to an existing SQL Server db. "

 

I will get a cRIO for tests tomorrow and will test the free trial version from Raima first.


Did you succeed with your testing? I'm looking to join a Linux powered cRIO to our SQL Server 2014 database and would really like to hear that the Raima database is suitable!

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 5 of 12
(4,621 Views)

Hi

 

We had some problem with the trial version from Raima. We couldn't connect to an SQL Server Database neither on a Windows Computer nor on the cRIO. The answer from Raima to my question was "Right now we no longer offer support for this product..." , "It is being sold on the LabVIEW Tools Netzwork "as-is" without support from Raima..."

 

After this we haven't spend to mutch time in the Raima Database.

We have now a solution with a Host-Application on a Windows Computer in the Network of our customer. This application uses the standart "Database Connectivity Toolkit" from LabVIEW. With this toolkit it isn't any problem to connect to a SQL Server. We send querys from the cRIO over TCP/IP to the Host-Application and the application handles all the database actions.

0 Kudos
Message 6 of 12
(4,610 Views)

@LukasKöpfli wrote:

The answer from Raima was "Right now we no longer offer support for this product..." , "It is being sold on the LabVIEW Tools Netzwork "as-is" without support from Raima..."

 


That's sad news.

 


We have now a solution with a Host-Application on a Windows Computer in the Network of our customer. This application uses the standart "Database Connectivity Toolkit" from LabVIEW. With this toolkit it isn't any problem to connect to a SQL Server. We send querys from the cRIO over TCP/IP to the Host-Application and the application handles all the database actions.


I am also considering an interception layer, except using a web-service as opposed to a LabVIEW host application. It should be able to receive secure HTTP queries from the cRIO and handle all the database interactions. Makes the target device system agnostic. But I'm not keen on my API to the database being a web service, I'd rather use native ODBC.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 7 of 12
(4,600 Views)

Has anything changed regarding this topic? Is there a good solution to host a database on a Linux-based cRIO (such as a 9068)? I am currently exploring this as an option to get controller information to a database for telemetry, but the overall feasibility is unknown since there's not much info I can find out there. Do we know if the DB toolkit will work on same cRIO if the DB is hosted elsewhere (Windows or Linux) box? I could live with just hosting it elsewhere. 

0 Kudos
Message 8 of 12
(3,987 Views)

Nothing has changed and is very unlikely to change in the near and even further future. That said it really depends what you want to do:

 

1) DB Toolkit is ActiveX based and therefore only can work on Windows. That is never going to change since even Microsoft considers ActiveX a legacy technology so nobody is going to invest even a microsecond anymore to make this work under Linux. Besides even if ActiveX could work under Linux, LabVIEW for Linux still would need to add support for it, which definitely never will happen.

 

2) This thread is based largely on the assumption that SQL Server is the only database option under the sky. That is of course nonsense. You can run SQLLite on just about every system that has a working C compiler. And over on Lavag.org there are at least two submissions for a project to add SQL Lite support to LabVIEW.

 

https://lavag.org/topic/13205-cr-sqlite-api/

https://lavag.org/topic/15857-cr-sqlite-library/?page=1

 

 

And then there are several paid for toolkits available too:

 

https://lvs-tools.co.uk/software/sqlite-api-labview-library/

http://sine.ni.com/nips/cds/view/p/lang/nl/nid/209317

 

At least some of them do have some support for LabVIEW for Linux RT.

 

While SQLLite is a file based database, so not really suited for a distributed database, there is also MySQL which supports a network protocol. While installing MySQL on a Linux RT system is theoretically possible, I don't feel that is a very sane approach. A database server and an RT system don't really fit together well. But there is at least one project somewhere which implements some of the MySQL network protocol natively with LabVIEW TCP nodes and several others which interface to the MySQL shared library driver.

Rolf Kalbermatter
My Blog
0 Kudos
Message 9 of 12
(3,982 Views)

In the first link, it mentioned only being supported within x32/x64 bit Windows environments. I looked at the second one by drjdpowell and it looks promising. For my particular application, we are looking to bundle all system data and do snapshots every few seconds for a telemetry project. This seems to lend itself well to the "bulk" specialty in SQLLite. There will be 2-way communication eventually, so monitoring a cell location for asynchronous, user-driven commands at most doesn't seem too taxing either. Have not inquired about compatibility running these functions when the code is deployed to a Linux cRIO.

 

 

 

0 Kudos
Message 10 of 12
(3,974 Views)