Search code examples
labview

How to access SQL Server database on slave PC from master PC using LabVIEW


I have got two PC connected on Local LAN. On client PC data is written using LabVIEW. So how to access the same database on server PC using LabVIEW.


Solution

  • In a nutshell, open a DB connection in your local PC o in a remote PC is the same. You should only change the connection parameters. Anyway, some details must be taken into account.

    Assuming that you are using a MS-SQL server, follow these points:

    • Be sure that your SQL server is accessible from the other PC. Follow this guide: Configure remote access SQL

    • I suggest you to use SQL Server Management Studio (SSMS) to check if your database is accessible.

    • In LabVIEW, use the Database Connection Toolkit to access to your DB. I suggest you to create a .UDL file and to use this file to open the DB connection.

    To create an UDL file:

    • Create a new file wherever you want.
    • Rename its extension to .udl.
    • Double click on the udl file and configure it
    • Test DB connection
    • in LabVIEW, you will need to use the DB Tools Open Connection VI. Wire your udl file path in the connection information input. Use the code snippet below for details. You can also drag and drop the picture in LabVIEW block diagram in order to have the code ready to use.

    DB snippet