SXI Forum

A place to collect usefull tips, tricks and implementation strategies.

You are not logged in.

#1 21-11-2018 11:07:09

SeanR
Administrator
Registered: 20-11-2018
Posts: 148

Windows Authentication to SQL server from Java

When trying to connect to a MSSQL database server that uses Windows Authentication please remember the following:

  1. Include the following property: useNTLMv2

  2. Include the following Domain property: domain=mydomain.local (where "mydomain.local" is the trusted windows domain of the user allowed to access the database)

These can be set in the applications configuration.

Offline

#2 12-01-2021 15:01:49

SeanR
Administrator
Registered: 20-11-2018
Posts: 148

Re: Windows Authentication to SQL server from Java

Here is an example:

<Connector id="XlayerDB" type="DB">
      <Connection xsi:type="sxi:MSSQL">
        <sxi:Server>127.0.0.1</sxi:Server>
        <sxi:User>myuser</sxi:User>
        <sxi:Password>secret</sxi:Password>
        <sxi:RetryDelay>10</sxi:RetryDelay>
        <sxi:DBName>SomeDB</sxi:DBName>
        <sxi:Properties>
          <sxi:Property name="useNTLMv2" value="true"/>
          <sxi:Property name="domain" value="ACME"/>
        </sxi:Properties>
        <sxi:Port>1433</sxi:Port>
      </Connection>
      <sxi:ReturnCodes>
        <sxi:Success/>
        <sxi:RecoverableError>
          <sxi:Code>.+Read timed out.+</sxi:Code>
          <sxi:Code>.*Invalid state.+</sxi:Code>
          <sxi:Code>.*SHUTDOWN is in progress.+</sxi:Code>
          <sxi:Code>I/O Error: Connection reset by peer: socket write error</sxi:Code>
        </sxi:RecoverableError>
      </sxi:ReturnCodes>
    </Connector>

Offline

Board footer

Powered by FluxBB