LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Database connectivity toolkit and MySQL

Solved!
Go to solution

Hi,

 

I have a few questions regarding DB connectivity toolkit.

 

1) Is it possible to have a few of this open concurrently connecting to the same local server but with different query?Capture.PNG

 

2) Is it possible to lost connection with a local server? Sometimes I get prompt that i lost connection with the local server after running the program for a few mins. 

 

3) Is there any way to have multiple queries executed with just 1 db tool open connection and 1 db close connection if the data i wanted are from the same table? The queries are shown below. 

 

First Query 

SELECT station_id,station_datetime,id,active_power_total, reactive_power_total FROM bp_rawdata WHERE station_id = 'P1001'ORDER BY station_datetime DESC;  

 

2nd query 

SELECT station_id,station_datetime,id,active_power_total, reactive_power_total FROM bp_rawdata WHERE station_id = 'P1004'ORDER BY station_datetime DESC;  

 

3rd query 

SELECT station_id,station_datetime,id,active_power_total, reactive_power_total FROM bp_rawdata WHERE station_id = 'P1002'ORDER BY station_datetime DESC;  

 

 

0 Kudos
Message 1 of 10
(6,294 Views)

1. Yes. But be sure to think about if it is neccesary and if it will cause race conditions.

2. Of course it is possible. But the reason for it - too little information to say!

3. Why not do something like this instead?

SELECT station_id,station_datetime,id,active_power_total, reactive_power_total FROM bp_rawdata WHERE station_id = 'P1002' OR station_id = "P1001.. and so on ORDER BY station_id, station_datetime DESC; 

0 Kudos
Message 2 of 10
(6,237 Views)

1) What is race conditions?

2) The below is the error msg after running the program for 30 mins. 

 

original.png

 

3) The data are in the same table and i wanted to show it in different array. that's why i used executed the query differently 

0 Kudos
Message 3 of 10
(6,230 Views)
1. LMGTFY: https://en.wikipedia.org/wiki/Race_condition
If the order you write/read information is important you need to enforce that order.
2. No idea, check database settings or logs. Maybe the database is set to close inactive connections? Check if the connection is active before you make the query and reopen the connection if neccesary.
3. Sure, but by using one query you can query the db once, and then split up the data anyway you want in Labview afterwards.
But why don't you simple do your three queries in sequence?
0 Kudos
Message 4 of 10
(6,207 Views)

Do you open and close the DB connection a lot? Open it once and use that connection until you close the program, much like you should do with VISA and files.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 10
(6,185 Views)

Hi, 

 

How do I execute multiple queries with just 1 connection? 

 

 

0 Kudos
Message 6 of 10
(6,182 Views)

Just execute "Select Data" three times after each other.

0 Kudos
Message 7 of 10
(6,175 Views)

Is it alright if I do it in sequence? I have attached the VI 

Thank you

0 Kudos
Message 8 of 10
(6,156 Views)
Solution
Accepted by topic author S.Neo

Think dataflow! You do not need the sequence structure (ever!) but be careful not to branch your error and reference wires at the wrong places.

Otherwise yes. But not very elegant, I still think you should have done it in a single query.

Message 9 of 10
(6,139 Views)

i have a access database with three columns. i want to insert data only 3rd column, other 2 column (auto number and time ) setting to auto update after data insert into 3rd column.  how can i do this task using labview database connecting toolkit 

0 Kudos
Message 10 of 10
(5,831 Views)