connectivity problems with deployed version of ADODB (SQLOLEDB Provider) connection to a Microsoft SQL Server

7 次查看(过去 30 天)
To access a Microsoft SQL Server we have successfully used ADODB and more specifically the SQLOLEDB provider in the "normal" Matlab context.
However the very same code does not work in deployed applications and since the used sqloledb.dll is provided by Windows the possible reasons are totally unclear. For example I have tried the following basic code to establish a connection:
connection_string='Provider=SQLOLEDB;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=OUR_CATALOG;Data Source=OUR_SERVER;';
conn = actxserver('ADODB.Connection');
conn.Open(connection_string);
While this code works fine in Matlab the deployed .exe (with mcc -N -m -v ADOdb_conn_test.m) brings up the error:
Error using COM.ADODB_Connection/Open
Invoke Error, Dispatch Exception:
Source: Microsoft OLE DB Provider for SQL Server
Description: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server existiert nicht oder Zugriff verweigert.
Error in ADOdb_conn_test (line 8)
MATLAB:COM:E2147500037
As you can see from the connection string integrated security is used and the problem might be linked to this fact...What could be the reason that such a connection works flawlessly in Matlab but not in a deployed exe?
By the way similar troubles arise with alternative JDBC connections, even when the hints from the integrated security answer are respected...
  1 个评论
florian
florian 2015-5-21
编辑:florian 2015-5-21
After checking nearly every possible reason I finally discovered that the deployed applications have to be started from a local drive!! ...This is true for the adodb version and also for jDBC approaches...Obviously otherwise integrated security authentification won't be successfull...

请先登录,再进行评论。

回答(1 个)

Umakant
Umakant 2015-5-20
Hi Florian,
Looking at the error message it seems that there is an issue when you establish a connection to the server. The most portable way to deploy a standalone application that requires SQL connection is given at the link below:
You may also find the following article useful to configure the Java run time library in MATLAB with and without admin privileges:
Thanks,
Umakant

类别

Help CenterFile Exchange 中查找有关 Database Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by