Description:
Our security does not allow us to enable SQL Server authentication on our SQL Server servers and trying to install MSSQL DDL generated by Gen causes an error:
TIS95DDL: Error -2147203052 connecting to the database server
TIS95DDL: Microsoft SQL-DMO (ODBC SQLState: 28000) returned error: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '<server_name>\<instance_name>'. The user is not associated with a trusted SQL Server connection.
Therefore we would like to be able to install the DDL using a Windows Authentication trusted connection.
Solution:
Installing using a trusted connection can be achieved as follows:
The module TIS95DDL.EXE is used by the Build Tool to install the MSSQL DDL. By default this uses SQL Server authentication with the values stored in the Build Tool profile DBMS/MSSQL tokens for OPT.DBUSER, OPT.DBPSWD, OPT.DBCONNECT. The source code for this module (tis95ddl.c) is supplied in the ddl sub-directory under the Gen install directory. To enable DDL installation via a trusted connection the following changes should be made:
hr = pSQL->lpVtbl->Connect(pSQL, wDatabase, wUsr, wPwd);Before the above line add this new line:
hr = pSQL->lpVtbl->SetLoginSecure(pSQL, TRUE);This ensures Windows Authentication/Trusted connection is used and the userid & password in the subsequent Connect are ignored.
dbOutput(msg);i.e. this is the line after:
sprintf(msg, tidbms_GetMessage(CONNECTION_PARMS),change the parameter in the dbOutput call to be for example:
argv[2], argv[3], strlen(argv[4]),
"****************************************");
dbOutput("Using Windows Authentication/Trusted connection");