0

I have a working JNDI with SQL server username and password in my Java application. It throws NameNotFoundException when I try to change the user to my domain user instead of SQL user.

Here it is mentioned I only have to provide integratedSecurity as true. Have I missed anything in my JNDI?

JNDI with SQL Server User:

<Resource
name="jdbc/MyJNDI"
auth="Container"
type="javax.sql.DataSource"
maxTotal="100"
maxIdle="30"
maxWaitMillis="1000"
validationQuery="select 1"
testOnBorrow="true"
testOnConnect="true"
testOnReturn="true"
testWhileIdle="true"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433;database=survey;user=myuser;password=mypassword;"
/>

My JNDI with domain user:

<Resource
name="jdbc/MyJNDI"
auth="Container"
type="javax.sql.DataSource"
maxTotal="100"
maxIdle="30"
maxWaitMillis="1000"
validationQuery="select 1"
testOnBorrow="true"
testOnConnect="true"
testOnReturn="true"
testWhileIdle="true"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433;database=survey;integratedSecurity=true;"
/>
Abdul Waheed
  • 63
  • 1
  • 10

1 Answers1

0

Another driver is necessary. See this source http://www.bigdata-unleashed.com/20150930/database-ntlm-authentifizierung

<Resource
name="jdbc/MyJNDI"
auth="Container"
type="javax.sql.DataSource"
maxTotal="100"
maxIdle="30"
maxWaitMillis="1000"
integratedSecurity="true"
validationQuery="select 1"
testOnBorrow="true"
testOnConnect="true"
testOnReturn="true"
testWhileIdle="true"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
driverClassName="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://localhost:1433;database=survey;"
/>

Database driver is available at http://sourceforge.net/projects/jtds/files/jtds/

vadzim dvorak
  • 939
  • 6
  • 24
  • Thanks for the reply. I tried changing the driver and JNDI but it still gives me the same error. I uploaded the driver in lib folder, replaced my JNDI entry and restarted the service. Is there any other thing I have to check? – Abdul Waheed Aug 14 '18 at 15:49