Regarding your last comment, from Powershell and Command Prompt, number is passed to compiled MATLAB function as characters, so, converting to double (str2double) is necessary. function [] = tampon(server, port, databasename, authType, idEnvironment)
which database
if ischar(port)
port = str2double(port);
end
conn = database(databasename, '', '', 'Server', server, 'PortNumber', port, 'Vendor', 'Microsoft SQL Server', 'AuthType', authType)
If you still gets an error, add disp(conn) and confirm JDBC is included properly to compiled exe.
If conn says "JDBC not found error", please try adding "mssql-jdbc-6.2.1.jre8.jar" and "sqljdbc_auth.dll" in "Files required for your application to run" in Application Compiler Window.
Best Answer