How can the Gen 7.x Build tool be configured to allow a Windows Authentication trusted connection when installing MSSQL DDL?

Document ID : KB000053546
Last Modified Date : 14/02/2018
Show Technical Document Details

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:

  1. In function dbConnect go to the line:
       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.

  2. For message purposes the following can also be changed. Go to the first occurrence of the line

      dbOutput(msg);
    i.e. this is the line after:

     sprintf(msg, tidbms_GetMessage(CONNECTION_PARMS),
    argv[2], argv[3], strlen(argv[4]),
    "****************************************");
    change the parameter in the dbOutput call to be for example:

     dbOutput("Using Windows Authentication/Trusted connection");
  3. Backup the current TIS95DDL.EXE in the Gen install directory.

    SQL Server Platform SDK needs to be installed and the INCLUDE and LIB environment variables need to contain references to the relevant SQL Server Platform SDK directories

    Run command 'makeddl mssql' to rebuild module TIS95DDL.EXE which will get updated in the Gen install directory.

  4. The new version of TIS95DDL.EXE will enable MSSQL DDL installs using a trusted connection.