LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting to an access database

Solved!
Go to solution

Hello I hope someone can help here.

 

I'm currently waiting for some training with Labview but for now google is helping me along.

We have had a new test bench installed with labview its not fully commissioned yet but mostly working.

It connected to our database(ms access(.accdb)) with no problems. However my boss went to try it and now it fails to connect, if I copy the project/files over and try it on my trial version on my own PC it connects just fine.

 

I find it strange how it did connect with no issues, now I get

Error -2147467259 occurred at NI_Database_API.lvlib:DB Tools Open Connec (String).vi->NI_Database_API.lvlib:DB Tools Open Connec (Path).vi->Database Read Example.vi




Possible reason(s):
ADO Error: 0x80004005
Exception occured in Microsoft Office Access Database Engine: Unrecognized database format 'F:\Infosys\Infosys_be.accdb'. in NI_Database_API.lvlib:DB Tools Open Connec (String).vi->NI_Database_API.lvlib:DB Tools Open Connec (Path).vi->Database Read Example.vi

 any help would be greatly appearicated !

0 Kudos
Message 1 of 25
(11,353 Views)

Hi deci, 

 

Can you tell the platform of OS and Office that you're using? (x86 or x64) 

Also sharing a snippet is very useful for these situations. 

 

Emre

Actor Framework rocks!
Emre TUZUNER
Message 2 of 25
(11,347 Views)

thanks etuzuner,

 

Both machines are win7 64bit/office 2013.

I have Labview2016 upstairs, the machine in question has Labview2014 but as stated is was working on that machine.

 

How would I go about posting a 'snippet'? do you mean a screenshot of the block diagram?

 

thanks again

 

 

 

 

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

How to create a snippet : http://www.ni.com/tutorial/9330/en/ . By this way, one can easily drag and drop your snippet to a block diagram in his/her computer if it is desired.

 

I assume that Microsoft Office is also x64. Normally, you should be able to use Database Connectivity VIs easily. I had similar problems at the beginning and the reason was the platform difference between Windows and Office. 

 

The easiest way to insert data example to db with creating a new table is shown at the snippet. I created a udl file which supplies a connection string to a db that I created before. If you don't know how to create a udl file in LabVIEW, you should take a look at these;

 

http://digital.ni.com/public.nsf/websearch/1D5EB4DCBD13106486256B9D005E11B0?OpenDocument

http://digital.ni.com/public.nsf/websearch/151C96CC8EFAB6A786256CC2007C1178?OpenDocument 

 

Generally, the problem is caused by Windows not LabVIEW or LabVIEW user. 🙂 You can easily create a udl file by the way shown in links above but platform incompatibility creates common errors. 

 

If you have any further questions, I'll be glad to help. 

Emre

 

Database example

 

Actor Framework rocks!
Emre TUZUNER
Message 4 of 25
(11,330 Views)

Thanks I've made a snippet,

yes office is 32bit, as is my office upstairs. But fails to give me issues up here.

 

I believe I've made the UDL correctly as it's using it ok upstairs.

such a strange error I just can't get to grips with it 😞 

0 Kudos
Message 5 of 25
(11,321 Views)

Ok deci, there is a way to understand that if you're facing the same problem I had. 

 

Please select "Microsoft OLE DB DB Provider for ODBC Drivers" as a provider. After clicking next, select "LabVIEW" in "Use data source name" part. This is a data source created by NI as an example in x86. Then if you're sure that you applied all of these test your connection. It should work like a charm. 🙂 If it works, there is a way to handle it and you're having the same problem that I told you. 

 

Can you try it and get back to me?

Emre

Actor Framework rocks!
Emre TUZUNER
0 Kudos
Message 6 of 25
(11,316 Views)

I do appolergise etuzuner,

are you reffering to the UDL file?

 

 

0 Kudos
Message 7 of 25
(11,307 Views)

Apology is mine, I forgot to tell you. Yes, I want to you to create a new UDL file with those selections.

Actor Framework rocks!
Emre TUZUNER
Message 8 of 25
(11,304 Views)

thanks etuzuner.

 

I dont see labVIEW in the drop down list, here whats avaliable.

1. dBASE files

2. excel files

3. MS Access database

4. TEMPODSN0

 

I really do appereciate your help with this matter 

0 Kudos
Message 9 of 25
(11,296 Views)

Ok then, let's create a whole database example. 

 

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

2. Choose "System DSN" tab. There are two types of DSN, I think difference is not important for now but you can take a look later. (http://digital.ni.com/public.nsf/allkb/852559036FB6447380256ADF007C3964). 

3. Click on "Add.." button and select "Microsoft Access Driver (*.mdb)" and then close it. 

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

5. Click on "Create.." and create an mdb file in your work folder. Then click on "OK". Now you created your data source file.

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

7. Select "Microsoft OLE DB DB Provider for ODBC Drivers" as a provider. After clicking next, select the data source name that you created recently under the "Use data source name" list. 

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

9. Voila.. 🙂 

 

You should be able to create a data source and UDL to that data source by following these steps. You can simply use the code I shared as a snippet. You need to replace existing UDL file with the new one you created though. 

 

Please keep me informed about what happened. 🙂 

Emre

 

Actor Framework rocks!
Emre TUZUNER
Message 10 of 25
(11,275 Views)