PDA

View Full Version : Window Authentication for SQL server.



Dheeraj_More
20th July 2010, 07:15 PM
Windows authentication mode for SQL server with jdbc

We need one dll file for this, sqljdbc_auth.dll (Download attached file),

Method I] -:

1) Copy sqljdbc_auth.dll file in a directory
eg-: D:\SMD\SQLSERVER\auth directory.

2)Stop Tomcat Service.

3)Then run tomacat5w.exe from tomcat's bin directory( eg-: D:\Tomcat 5.0\bin\tomacat5w.exe )
Select tab java. In 'Java Options' add following entry.Later click Apply and Ok.

-Djava.library.path= D:\SMD\SQLSERVER\auth

4)Start Tomcat service.

5)Open Biplus Admin interface, click Admin-> Datasources,add new Datasource having Driver name
Microsoft SQL Server.Keep User Name and Password empty.Then in Connection URL add following(Here eg-: DatabaseName = Northwind )

jdbc:sqlserver://localhost:1433;SelectMethod=cursor;DatabaseName=No rthwind;integratedSecurity=true

6)On clicking Test Connection,You will get message 'Datasource connection is successful'.

Method II] -:

1)Copy sqljdbc_auth.dll file in sytem32 directory(eg-: c:/WINDOWS/system32).

2)Open Biplus Admin interface, click Admin-> Datasources, add new Datasource having Driver name
Microsoft SQL Server.Keep User Name and Password empty.Then in Connection URL add following(Here eg-: DatabaseName = Northwind )

jdbc:sqlserver://localhost:1433;SelectMethod=cursor;DatabaseName=No rthwind;integratedSecurity=true

3)On clicking Test Connection,You will get message 'Datasource connection is successful'.


-------------------------------------------------------------------------------
Tips,Errors and Solution -:

1) Use sqljdbc.jar for sql server 2005 driver.


2)Error-: Login failed for user 'username'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)

Solution-: Make sure tomcat is run using an account which has access to sql server machine, for this
Go to Services ->Apache Tomcat(Double click) ->Log On tab,Check and change account setting in case.

3)Error-: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect

Solution-: In SQL Server Configuration Manager->SQL Server 2005 Network Configuration->Protocols for MSSQLSERVER->TCP/IP.Enable status of TCP/IP.
-------------------------------------------------------------------------------------------------------------
Sources:
http://support.microsoft.com/kb/889615
http://msdn.microsoft.com/en-us/library/ms378428.aspx#Connectingintegrated