LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is SQL suitable for me? (save and frequent calling Data)

Hello

I'm working on a program that need to calling Data frequently and save it. I have 7 or 8 part that seperatly need to use data of a database. calculate and save them again.

formerly, I used Excel as a database, but sometime, my labview stoped unexpected. I think, the reason was: frequently open and close of excel. when stoped my program, Excel couldnt be close and locked!

now, I want use SQL instead of Excel. is it suitable for me? 

 

thank you

 

Best Regards

 

0 Kudos
Message 1 of 9
(3,224 Views)

How fast? You can try SQL express edition and check.

PBP
Labview 6.1 - 2019
0 Kudos
Message 2 of 9
(3,215 Views)

Hi PBP

I didnt work with SQL until now. I want sure about it's ability in labview at first.

 

Best Regards

0 Kudos
Message 3 of 9
(3,201 Views)

Try learning about SQL query and Database connectivity toolkit.

PBP
Labview 6.1 - 2019
0 Kudos
Message 4 of 9
(3,184 Views)

SQL isn't going to be suitable if you have really high data rates (from some benchmarking I did a while ago).

 

Any sort of file based method (with the exception of TDMS which can read while writing) is going to have problems with locking files while they are opened in one place and using Excel to do this will create massive amounts of overhead launching/closing Excel as you have noticed.

 

I think a database is probably the right solution but you might want to look at using something like SQLite - it's a file-based SQL-like database that allows you to create tables / do lookups etc.. There's an SQLite library available in VI Package Manager (vipm://drjdpowell_lib_sqlite_labview?repo_url=http://ftp.ni.com/evaluation/labview/lvtn/vipm). Unless you need the full relational/query capabilities of a proper SQL engine or you need access to the database from different machines this might be an appropriate solution.

 

I would recommend designing your application so that you have a database 'module' in your software that handles all of the database requests and all interaction with the database is done there and your 7-8 parts of the software request/submit data to the database module - this gets around problems of file locking. That's probably what I would do, anyway.

 


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 5 of 9
(3,180 Views)

thank you;

 

may you introduce tolls that I should work them?

is any better toolkit?

is any necessary information?

 

what is the first step to work with SQL?

 

Best Regards

0 Kudos
Message 6 of 9
(3,065 Views)
As already mentioned, NI sells the Database Connectivity Toolkit. There are other free solutions. I've used LabSQL - http://jeffreytravis.com/lost/labsql.html.

There are numerous tutorials available on using SQL. Google it. All of the toolkits permit different databases such as MySQL, SQLServer, Jet (Access), etc.
Message 7 of 9
(3,043 Views)

Just as a FYI, make sure that you are opening and closing the file/SQL database once. There is no need to open and close them repeatadly.

 

Also, I wonder if a Producer-Consumer loop with Data Batching would work for you. How often are you doing your data saves and reads?

Message 8 of 9
(3,034 Views)

A couple of notes on SQLite:

1) it is a full SQL database (what it isn't is a database server).

2) it doesn't lock an open file, so there can be many open connections to it.  In general, the main locking issue is that open SQL write transactions block other write transactions (but not reads if one sets SQLite to use "WAL" mode). 

Message 9 of 9
(3,016 Views)