09-02-2015 03:32 PM
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:
<?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
2) Write Event.vi (this is the "EVENTS" sub-VI)
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
09-02-2015 04:52 PM
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.
09-04-2015 02:01 PM - edited 09-04-2015 02:04 PM
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