From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send data from MYSQL to another computer on the same network using LabVIEW?

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

0 Kudos
Message 1 of 10
(4,774 Views)

If it is in LAN then you can use the UDL file to connect to database.

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 2 of 10
(4,771 Views)

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..

0 Kudos
Message 3 of 10
(4,765 Views)

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".

 

 

 

 

0 Kudos
Message 4 of 10
(4,758 Views)

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 🙂

0 Kudos
Message 5 of 10
(4,740 Views)

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?).

 

 

Message 6 of 10
(4,734 Views)

@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.

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
Message 7 of 10
(4,664 Views)

@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

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

Qestit Systems
Certified-LabVIEW-Developer
Message 8 of 10
(4,660 Views)

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. 

Message 9 of 10
(4,655 Views)

@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.

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 10
(4,645 Views)