05-31-2016 06:43 AM
Hi guys,
This is my firs time writing here, so sorry for possible mistakes and incomplete question.
Thing is, MYSQL database is on computer which is used as server and I am connected to it via Remote Desktop Connection on Windows. My LabVIEW program is on my PC and is exporting data from MYSQL database (which is on another computer as I wrote). Unfortunately data is exported on the computer with MYSQL server, but I need it on my computer. Is it possible to be made using LabVIEW application?
In order to access database from MYSQL I use Connectivity -> Database subVIs. Inside LabVIEW app is a query which is a command to MYSQL and that is how I create files with required data. Only thing is that it is not on desired destination.
Thanks in advance,
Ivan
05-31-2016 06:46 AM
If it is in LAN then you can use the UDL file to connect to database.
05-31-2016 07:01 AM
Is there a possibility to use UDL file inside LabVIEW app?
Sorry for incomplete message, idea is that app is universal. That is, user of the app should be able to get data from MySQL server database just based on possibility to connect to the same MySQL database, whether it is connected over LAN or not..
05-31-2016 07:12 AM
Maybe you have to install on LabVIEW PC side "MySQL ODBC Connector" and then configure Windows (Administrative tools -> Data Source -> Add ->MySQL ODBC ANSI Driver and set other entries (IP, Username, Password and port) to enable MySQL database connection from a PC to another.
After that you should create an empty file with .udl extension.
Open it and from Providers tab select Microsoft OLD DB provider for ODBC.
In the connection TAB you'll se your database name inside "Data Source Name " control.
Set other information such as Name, Password and database table name.
Click "Check connection" to see if it is OK.
At the end, click OK the window closes and you have saved and configured your .udl.
Now open it with a text editor and you will find the connection string to set in your LabVIEW code when opening a connection (connection string) to the remote database as follows:
Provider=MSDASQL.1;Persist Security Info=False;User ID=username;Data Source=databasename;Initial Catalog=tablename
Simply copy and paste as a string constant inside your vi, when you use the labVIEW Database Toolkit "Open Connection .vi ", at the terminal named "connection Information".
05-31-2016 07:58 AM
Thank you for your response, but I think there is some misunderstanding.
I have made a connection between LabVIEW and MySQL, it works just fine. Problem is with ExecuteQuery.vi which executes query which i send to MySQL in string format. Query is about exporting files and it really does export files, but not on my computer (from which is LabVIEW app running). It exports files onto computer on which is MySQL database. Now what I want is somehow to send those files NOT onto server computer, but to computer from which is LabVIEW app running.
This might be a little bit confusing, but I am new at LabVIEW and SQL so any help is appreciated 🙂
05-31-2016 08:13 AM
Sorry, Iam not sure to understand what you need..
I try to reply.
Seen from one side, maybe it is a MySQL statement issue, in this case you should pack an execution string which is able to save your output file remotely.
But if you see this from client's side (LabVIEW), it is possible to transfer your output file from server to any other PC once it is created.
You could execute your query, that saves the output file on server sid inside a shared folder.
After that, your client checks the server's shared folder if it's empty or if a new file is available for transfer. (e.g. use build path with '\\machinename\folder\filename.ext').
If a new file is created, you could transfer it from server to client side (FTP?).
06-03-2016 06:12 AM
@Blomquist wrote:Is there a possibility to use UDL file inside LabVIEW app?
Sorry for incomplete message, idea is that app is universal. That is, user of the app should be able to get data from MySQL server database just based on possibility to connect to the same MySQL database, whether it is connected over LAN or not..
Yes,
Using UDL you can connect any database. If it is not local then by IP you can access.
06-03-2016 06:50 AM
@Blomquist wrote:
My LabVIEW program is on my PC and is exporting data from MYSQL database (which is on another computer as I wrote). Unfortunately data is exported on the computer with MYSQL server, but I need it on my computer.
It sounds like a file-path problem. If you export to a file, you can simply change the target path and voila! All that might be needed is to map a network disk, as i think LV might have issues with a \\server\share-path. If you map e.g. X: to \\server\path saving to X: should work fine.
/Y
06-03-2016 07:30 AM
Thanks guys,
I used LV to export a file onto Shared Folder and it was easy to fetch it and send data to prefered location on my computer.
06-03-2016 10:11 AM
@Yamaeda wrote:
It sounds like a file-path problem. If you export to a file, you can simply change the target path and voila! All that might be needed is to map a network disk, as i think LV might have issues with a \\server\share-path. If you map e.g. X: to \\server\path saving to X: should work fine.
/Y
LabVIEW for Windows fully supports UNC paths. So that is not a problem actually.
Now depending on the network protocol that is under the according UNC name you may have more or less problems. But nowadays most networks use the Microsoft protocol and should work pretty good. With NSF or Novel IPX, this was another story.