Tuesday, August 11, 2015

Example context.xml for JNDI resource for MSSQL with Windows authentication

<Resource name="jdbc/mydb"
        auth="Container"
        driverClassName="net.sourceforge.jtds.jdbc.Driver"
        maxActive="100"
        maxIdle="30"
        maxWait="10000"
        removeAbandoned="true"
        removeAbandonedTimeout="60"
        autoReconnect="true"
        logAbandoned="true"
        username="username"
        password="password"
        type="javax.sql.DataSource"
        url="jdbc:jtds:sqlserver://myserver.mydomain.com:1433;databaseName=mydb;useNTLMv2=true;domain=mydomain;"
        validationQuery="SELECT 1"
        validationQueryTimeout="1000"
        testOnBorrow="true" />