LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting to an access database

Solved!
Go to solution

Unfortunately I dont have 'microsoft access driver' in step 3

all that is listed in the system DSN tab when clicking 'add' is 

1. SQL server

2. SQL server native client 

 

 

This was orginally set up by a third party who made the test bench.

looking at his UDL file is appears to use microsoft OLE DB provider for SQL Server.

 

I do also recall the guy saying something about directly using SQL statments?

 

I hope this some how sheds some light on this issue 

 

 

 

0 Kudos
Message 11 of 25
(3,376 Views)

Of course you can but you don't need to use statements. It is against to LabVIEW's nature. The main advantage of LabVIEW is that you don't need to know everything about coding.

 

Did you install any SQL server to that computer? If not, you can download SQL Server Express 2016 from https://www.microsoft.com/en-us/download/details.aspx?id=52679. 

 

Assume that you've installed. So let's write a similar procedure to Access.

 

1. Go to "Administrative Tools" in "Control Panel". Find "ODBC Data Sources (32 Bit)" and double click on it.

2. Click on "Add.." button and select "SQL Server" and then close it. 

3. Write a "Data Source Name" as you wish. 

4. Select the SQL server. Probably, you'll see something like "yourdomainname\SQLEXPRESS". Then click Next. 

5. Click "Next", again click "Next" and close it.

6. Click "Test Data Source" and probably you'll successfully create data source file. Then close it. 

7. Open LabVIEW, find "Create Data Link.." under Tools menu and open it. 

8.  Select "Microsoft OLE DB DB Provider for SQL Server" as a provider. After clicking next, connection tab will be opened. Select the provider listed "yourdomainname\SQLEXPRESS" and select "Use Windows NT security.." (I don't know the exact version because my OS language is not English.) 

9. After you select, click on "Test Connection".

10. Again, voila.. 😉 

 

By this way, you will be able to use the same code but different database configuration. The main reason why I'm in love with LabVIEW. 🙂

 

Please keep me informed. 

Emre

Actor Framework rocks!
Emre TUZUNER
Message 12 of 25
(3,364 Views)

Thanks Emre you've been a great source of help with this issue.

 

 

I tried the steps above however in the server selection drop down list SQL server was not in the list.

I really dont want to install more things as the testbench has not been commsioned, i'm just trying to understand and regain the orginal connection.

 

tbh the the VI seems odd as it calls for Table1 which actually doesnt exsit on my database that much I do know. 

 

0 Kudos
Message 13 of 25
(3,344 Views)

It's been a pleassure but I wish you had your problem solved. I think these procedures will guide your or anyone in the future when it is needed to build an application including database connectivity. 

 

Emre

Actor Framework rocks!
Emre TUZUNER
Message 14 of 25
(3,336 Views)

I have not had luck trying to connect to .ACCDB files.  I have always used .MDB files because of this.  I don't know the difference and have never taken the time to investigate.  Having said that, you won't be able to connect to either dB if you don't have the proper ODBC driver installed.  If you search the Microsoft website for ODBC drivers, you should find what you need. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 15 of 25
(3,326 Views)

Thanks for your input, the strange thing is that it was working just fine with .accdb then it just seemed to randomly stop.

 

The third party vendor is currently debugging via remote desktop.

It's good watch him as I can see he's trying everything I did, so for newbie I was on the right path. 

0 Kudos
Message 16 of 25
(3,322 Views)

Also keep in mind that if you are on a 64bit OS, you should use the ODBC in the SYSWOW64 folder.  The one in the control panels won't work properly.

c:\Windows\SysWOW64\odbcad32.exe

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 17 of 25
(3,318 Views)

thanks thats very helpful I can see labview in the system DSN TAB now

0 Kudos
Message 18 of 25
(3,313 Views)

You should not use the LabVIEW DSN for your code.  Add your own DSN that uses the same driver as the LabVIEW one but points to a different mdb file.  If you mess around and change something in the Labview DSN, your examples that ship with Labview will stop working.  

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 19 of 25
(3,305 Views)

Yes deci, I told you to use LabVIEW data source because you can easily check what you're doing. Of course you should create your own data source for your application. 

 

I had similar problems and I found where the problem was by doing as I said. 

 

Emre

 

 

 

Actor Framework rocks!
Emre TUZUNER
Message 20 of 25
(3,302 Views)