04-06-2010 12:50 PM
Here is a VI that i am trying to put together. I am trying to connect to a remote SQL database and run queries. I can connect retreive the data, but i cannot use the database variant to data. I am really green with this whole procces.
Please help,
Solved! Go to Solution.
04-06-2010 12:58 PM
The output of the Fetch All function is a 2D array of Variant. The Variant to Data function only takes in a single value. Put the function inside 2 nested loops to convert each element in the 2D array to a data type. Rebuild the array by enabling indexing on the exiting of the loops.
04-06-2010 01:19 PM - edited 04-06-2010 01:20 PM
Look at the shipping examples, specifically:
examples\database\Read All Data.vi
The examples are found by selecting Help-> Find Examples... and entering a keyword of 'database'.
If all you want to do is display the contents of a table, there is a function used in the vi above called
vi.lib\addons\database\Auxilliary.llb\DB Tools Select All Data.vi
that returns a 2D array of strings. This specific VI is not in the palettes and must be copied from the example or placed by using Select a VI... from the top of the palettes menu.
04-06-2010 01:25 PM
I am actually trying to connect, query and then use the query as an array for other VI's.
04-07-2010 09:48 AM - edited 04-07-2010 09:49 AM
TRAVO,
There is a new feature in Database Connectivity Toolkit in 2010 that can convert that array into specified data type you want directly. You can try it in LabVIEW platform 2010 beta.
04-07-2010 09:58 AM
I have 8.5.1 will this matter? Also, it would be nice if I could see the master with all the other database's and tables, and maybe keep a session open for queries rather than having to re-open the connection.
I appreciate the help
04-07-2010 10:05 AM - edited 04-07-2010 10:12 AM
04-07-2010 10:12 AM
Neil Li wrote:TRAVO,
There is a new feature in Database Connectivity Toolkit in 2010 that can convert that array into specified data type you want directly. You can try it in LabVIEW platform 2010 beta.
Message Edited by Neil Li on 04-07-2010 09:49 AM
Please re-read the beta agreement. You are not allowed to discuss features of LabVIEW 2010 or anything else associated with the beta in a public forum.
04-07-2010 10:15 AM
04-07-2010 10:21 AM
Sorry for being unclear, basically we have a central server that gets replication from many other servers. I would like to open the connection and keep it open. I think right now it opens connection, runs query,then closes connection. Now, i can use other interface tools (i.e. Toad SQLserver) to run multiple queries, but the amount of data that i am trying to pull and then run analysis on is too much for most applications. I can crunch through 1 years worth of 10min datapoints in about 8 seconds, so it just seems logical to hook the two together to cut out the middle guy.
I also work in a monitoring center, I would like to use the continuous connection and data replication (continuous updating of data) to create a more intelligent monitoring system (big picture and far out of my reach right now ha). I would like to make a data crawler in some sense with triggers.