0

I have a problem connecting Grails application with Sql server using windows authentication.

This is my connection code:

     dataSource_lookup{
            pooled = true
            driverClassName = "net.sourceforge.jtds.jdbc.Driver"
            dialect = "org.hibernate.dialect.SQLServer2008Dialect"
            //domain = "webshop"
            username = "username"
            password = "password"

            url =     "jdbc:jtds:sqlserver://111.222.3.4:1433/sqlDB;integratedSecurity=true;"

            logSql = true

        properties {
            //integratedSecurity = "true"
            maxActive = 50
            maxIdle = 20
            minIdle = 10
            initialSize = 1
            minEvictableIdleTimeMillis = 60000
            timeBetweenEvictionRunsMillis = 60000
            maxWait = 10000
            testOnBorrow=true
            testOnReturn=true
            testWhileIdle=true
            validationQuery="SELECT 1"
        }
    }

I tried connecting to SQL with HeidiSQL and it works. Checkbox for windows authentication must be checked, otherwise connection fails.

In Grails app I receive this message:

Message: Error creating bean with name 'controllerHandlerMappings':      Cannot resolve reference to bean 'openSessionInViewInterceptor_lookup' while     setting bean property 'interceptors' with key [2]; nested exception is     org.springframework.beans.factory.BeanCreationException: Error creating bean     with name 'openSessionInViewInterceptor_lookup': Cannot resolve reference to     bean 'sessionFactory_lookup' while setting bean property 'sessionFactory';     nested exception is org.springframework.beans.factory.BeanCreationException:     Error creating bean with name 'sessionFactory_lookup': Cannot resolve      reference to bean 'lobHandlerDetector_lookup' while setting bean property     'lobHandler'; nested exception is     org.springframework.beans.factory.BeanCreationException: Error creating bean     with name 'lobHandlerDetector_lookup': Invocation of init method failed;      nested exception is org.springframework.jdbc.support.MetaDataAccessException:     Error while extracting DatabaseMetaData; nested exception is     org.apache.commons.dbcp.SQLNestedException: Cannot create     PoolableConnectionFactory (Login failed for user 'username'.)

Could someone give me an advice what to do? Thanks in advance.

pep
  • 107
  • 2
  • 11

1 Answers1

0

In the meantime I tried other things and one of them worked. This is the solution.

url ="jdbc:jtds:sqlserver://111.222.3.4:1433;databaseName=sqlDB;domain=webshop;useNTLMv2=true;"

Connect To SQL Server With Windows Authentication From A Linux Machine Through JDBC

The accepted answer saved me.

Community
  • 1
  • 1
pep
  • 107
  • 2
  • 11