JDBC Database connection through command failing.

2 ビュー (過去 30 日間)
Davin
Davin 2014 年 9 月 2 日
回答済み: Davin 2014 年 9 月 2 日
Hello,
I have an issue which i dont really know how to resolve. I have connected my matlab env with a MSSQL server, using an sqlexpress db to store the data. I used a JDBC connection to link MATLAB with this database and its working fine. I have an windows authentication. When I type dexplore, open, i can configure a jdbc connection then i can see my db name, which i can access.
Now I want to make a command connection using this command line:
conn = database('dbName','','','com.microsoft.sqlserver.jdbc.SQLServerDriver','jdbc:sqlserver://servername:portnumber;database=dbName;integratedSecurity=true;')
and its now working i am getting the following :
Cannot open database "GLOBALMACRO" requested by the login. The login failed. ClientConnectionId:86ac96d0-178d-48e2-80f3-a5b75a82162a.
I used the following command :
conn = database('GLOBALMACRO','','','com.microsoft.sqlserver.jdbc.SQLServerDriver','jdbc:sqlserver://TW\SQLEXPRESS:1433;database=GLOBALMACRO;integratedSecurity=true;')
Why can i access the database via the database toolkit, and cant make a connection via the above command? is there something wrong in the synthax?
I have all the rights, the sqlexpress in the studio all have TCP/IP connections equal to 1433.
Thank you very much for the help
D

採用された回答

Davin
Davin 2014 年 9 月 2 日
I found a workaround issue which might help someone if ever one has the same issue, I connected to dexplore, connected to my database, I selected any table and imported the table by selecting Generating Script. And it gives you the syntax to connect to the database which is
conn = database('', '', '', 'Vendor', 'MICROSOFT SQL SERVER', 'Server', 'TW\SQLEXPRESS', 'PortNumber', 1433, 'AuthType', 'Windows');
And this works.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDatabase Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by