LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing data to Microsoft SQL Server/Database

Managed to write to a file that was created in MS Access with the various tables/structure required by my clients and pointed to the ODBC which held the file location as suggested and all worked fine.
 
My client wants the user access to their database and the test rig to be password controlled, so I was thinking of the following and would appreciate any comments as I have the 'feeling' it is may not be the best approach or secure;-
 
Rather than two sets of user names and passwords for gaining  access to the test rig and then the database respectivly use one username and password that would then give the user access to both the test rig and database.
 
Because there will probably be 5 or 6 users there would be a table holding their information within my Labview program. Problem arises with the table being stored in Labview though if my client wants to alter the user names/passwords. So I have used a vi that reads an excel file (from a post in the forum using active x) holding user names and passwords and in turn after validation passes them onto the external database whilst also allowing user access to the test rig.
 
The only problem with this method at the moment is I have to specifically state the Excel file location and wondered if a similar technique to using the ODBC could be used thereby not having to explicitly specify the file location?
 
 
 
 
Labview Version 8.5
Labview Version 8.6
Labview Version 2014
0 Kudos
Message 11 of 12
(982 Views)

You should consider whether the users really need to have access to the DB.
Generally, users do not interact with databases, only programs or administrators.

What you might want to do is have a single user\pass which your program will use to connect to the DB (this you can do from the Open Connection VI) and have a table inside the DB which will hold user account data such as name, password and level. The program will use those settings to allow users access.

The user\pass connection to the DB can either be hardcoded in your code or written to an ASCII configuration file, which is much simpler and less problematic than working with Excel (see the File palette for the config file VIs). The path to the config VI can be hard coded relative to where your VI/exe is (just note that when building, the EXE itself is usually considered to be a folder).
If you want the user name and password to be protected, you should probably use some sort of encryption to protect them. If you have LV 8.x, you should have an MD5 VI built in. If not, you can find one in one of the OpenG packages (which are a recommended download, anyway).

If you still want an answer, you can also use the config file VIs to store the path to your Excel file, although I would strongly advise against using that method (since, for example, Office interfaces tend to change between version and installing a different version of Excel could make your program not work).


___________________
Try to take over the world!
0 Kudos
Message 12 of 12
(971 Views)