11-11-2011 07:49 AM
Hello all
I made database (see picture) to log my data.
Now I want to connect this database to SQL, but didn't find any example for this on forum; I read some tutorials but I'm little confused, with UDL... Second question is where is this data stored on my PC (mdb file)
Thank you.
Solved! Go to Solution.
11-11-2011 09:25 AM
It's unclear to me what you are asking for. The database toolkit issues SQL commands via ADO to write/read to the database you've created, it appears you are already using a UDL file, and the database file itself is where ever you created it with Access.
11-11-2011 09:36 AM
The database toolkit helps you CONNECT to a pre-existing database. Nothing in your code "made" a database. By using the Get UDL.vi, you simply connected to a LabVIEW example database (assuming it's set up on your PC which I think Labview does for you).
SQL is just the protocol language (Structured Query Language) you use to talk to a database, you don't "connect" to it.
The data will be stored in the database you're connected to. Where it is, is wherever you (or your sys admin) put it.
A UDL (Universal Data Link) is the information file used to link programs in your computer to your database (wherever it is...). You'll need to set up the connection using your system admin tools for ODBC. You'll probably see the one (mdb) LabVIEW set up for you under System DSN. See how it's configured to get an idea how to set up your own.
11-11-2011 09:51 AM
Hi all, yes I messed up all; I read now documentation of "Database Connectivity Toolkit", but still have some questions:
1. If I left "udl" in my case empty, will it save automatically to "labview.udl" ? Will overwrite it or what? I need my own database on my PC;
2. so I will use "SQL language" on "DB tools execute Query" block ??
3. I also try to create .udl file ( I create it then choose-> Microsoft OLE DB Provider for ODBC Drivers; at connection tab I choose "Ms Access Database", wtihout password; and click OK). Then go to project as on picture up, and choose path to this .udl file; but I think nothing happend; The size of *.udl is 1KB
11-11-2011 11:20 AM
1. No, I think it will prompt you for a connection but connection info must be provided or it will not know what to connect to.
2. Yes, you can send your own queries with DB Tools Execute Query.VI or use the database tools for simple storing/retrieving/etc.
3. If you're trying to use your own database then you must create your database first, then you can set up a connection and communicate with it.
Again, LabVIEW will not create your database. You must do it yourself with MS Access or whatever. You decide what tables go in the database, what fields are in each table, which table fields are keys, how the keys link the tables, etc.... Once you are done with that, you use LabVIEW to add, update, modify, read and delete the records in your tables.
If this is unclear you need to google "database tutorials" and understand the concepts before you begin.
11-11-2011 11:29 AM
Your code will create the table Logging in the database referred to by the UDL.
You need to install sql express, access or something similar, create a database in that and then link the UDL to that database.
/Y
11-11-2011 11:31 AM
Hmmm, so Labview will not create automatically "database" from my input's(for example data receiving from OPC server)? There is no other way, just to manually create database in access...?
11-11-2011 12:30 PM
But if I run my .vi(as on picture) without and .udl path, everything working; but I don't know where is logging my data; maybe to labview.udl ???
11-11-2011 01:32 PM
Of course it's using LabVIEW.udl. That is exactly what the help says it is doing and you can see for yourself just by looking at the block diagram. Get UDL File Path function is intended to be using with only the shipping example database.
11-11-2011 01:39 PM - edited 11-11-2011 01:41 PM
Ok, then this udl is just for example...?
Then only way is to create "udl" with MS Access(this one I have installed), and then change path in .vi to this udl. After that will be logging my input to this .udl ?
How can I then for example show this data from this database, I just read again this .udl?