LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Web services and ADO SQL trouble

 

I have some trouble to connect to a SQL database through a web service. I'm stuck because when I run the VI from the labView front panel or the block diagram, everything works well (he ODBC connection works with no errors). I just don't understand why when the VI is executed from the web service I get an error in the same Open.vi that worked well from labView.

 

Here is the response I get in my browser window when I execute the following Method URL:

 

http://127.0.0.1:8080/Digital_Output_Web_Service/Digital_Output_Events_6501_-_Dev4?Status=0&Line=0&P...

 

<?xml version="1.0"?>
-<Response>
  -<Terminal>
    <Name>error DAQ</Name>
    -<Value>
      <Name>status</Name>
      <Value>0</Value>
      <Name>code</Name>
      <Value>0</Value>
      <Name>source</Name>
      <Value/>
    </Value>
  </Terminal>
  -<Terminal>
    <Name>error SQL</Name>
    -<Value>
      <Name>status</Name>
      <Value>1</Value>
      <Name>code</Name>
      <Value>-2147467259</Value>
      <Name>source</Name>
      <Value>Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified in ADO Connection Open.vi->Write Event.vi->Digital Output Events 6501 - Dev4.vi->Digital Output Events 6501 - Dev4.vi.ProxyCaller</Value>
    </Value>
  </Terminal>
  -<Terminal>
    <Name>value</Name>
    <Value>Status=0&Line=0&Port=0</Value>
  </Terminal>
</Response>

The VI's I'm running are quite simple:

 

1) Digital Outputs Events 6501 - Dev4.vi

 

1.png

2) Write Event.vi (this is the "EVENTS" sub-VI)

 

2.png

 

I'm running labView in a 64 bit Windows 8.1 system

 

My question is simple. ¿Why does the ADO Open Connection task work well if I run Digital Outputs Events 6501 - Dev4.vi manually from the front panel or block diagram, but the task doesn't work when I call the web service from my browser?

 

Thanks for your help

 

0 Kudos
Message 1 of 3
(2,732 Views)

The error code says that it can't locate the DSN (Trasterox).  Have you tried using just a connection string rather than pointing it to a DSN?  I am not familiar with web services. 

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 2 of 3
(2,717 Views)

I found the reason it wasn't working.

 

I defined the DSN in the "user DSN" tab but not in "system DSN" tab. "User DSN" tab definitions work well when exceuting the VI from LabVIEW or a .EXE application or even from the web service debugging method URL, but when the VI is executed from a web service, the ODBC connections defined in the "user DSN" tab cannot be accessed by the web service. So the solution was simple: just make sure to define the ODBC connections in the "system DSN" tab.

 

Thanks for your help anyway

0 Kudos
Message 3 of 3
(2,681 Views)