필터 지우기
필터 지우기

How do I deploy a MATLAB function which uses Database Toolbox functionality with Microsoft SQL Server Integrated Security?

조회 수: 5 (최근 30일)
I am using a Database connection to a Microsoft SQL Server with Integrated Security in my MATLAB function. I had to update librarypath.txt and classpath.txt and then this works fine inside MATLAB. Now I want to use MATLAB Compiler to create a standalone application. How do I include sqljdbc4.jar and sqljdbc_auth.dll in my application such that it can also use the database connection with integrated security?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2016년 2월 24일
The most portable way to deploy such an application would be the following:
For MATLAB/Database Toolbox releases R2012b and newer:
1. When following the instructions to add the directory containing the authentication DLLs to the MATLAB Java Library Path, do not work with $MATLABROOT\toolbox\local\librarypath.txt but use $PREFDIR\javalibrarypath.txt instead. (Where $PREFDIR stands for the directory returned by the prefdir function. Further javalibrarypath.txt does not exist by default so you may need to create it by yourself). When writing the file, do not only add the directory containing the DLL on your development machine; also add a line containing a single dot. The MCR will interpret this dot as "the current directory", this will allow us to place sqljdbc_auth.dll next to your EXE-file of the deployed application. (Note that $PREFDIR\javalibrarypath.txt automatically gets compiled into the application at compile time).
2. Compile sqljdbc4.jar into your application by adding it to the "Shared Resources and Helper Files" (or "Files required for your application to run" in later MATLAB versions) in DEPLOYTOOL or by using the -a option with MCC.
3. Whenever you distribute your application to someone else, make sure that sqljdbc_auth.dll is indeed placed next to the EXE-file.
For MATLAB/Database Toolbox releases R2012a and earlier:
1. Compile sqljdbc4.jar into your application by adding it to the "Shared Resources and Helper Files" in DEPLOYTOOL or by using the -a option with MCC.
2. Create a copy of your librarypath.txt and in this copy replace the directory name of the directory containing sqljdbc_auth.dll with a single dot "." (without the quotes). MATLAB will interpret this dot as "the current directory".
3. Place this new librarypath.txt in the same directory as your standalone EXE-file (i.e. which at runtime will be "the current directory" as above). Also place sqljdbc_auth.dll in this directory.
4. Whenever you distribute your application to someone else, make sure that librarypath.txt and sqljdbc_auth.dll are indeed placed next to the EXE-file.
  댓글 수: 4
Marc Youcef
Marc Youcef 2019년 8월 23일
In case of Web App, you have to add the DLL directory to the librarypath.txt in Local/toolbox from your Runtime Installation folder. Same for you jar file full file path in classpath.txt from runtime installation folder.
Martijn
Martijn 2020년 7월 9일
We have published a new article on MATLAB Answers with more detailed information on deploying to MathWorks Server based products like MATLAB Production Server and MATLAB Web App Server:

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

제품


릴리스

R2012a

Community Treasure Hunt

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

Start Hunting!

Translated by