Have you ever wanted to stay away from using mixed mode authentication in SQL Server 2005, but were told that you had to enable for SQL Server to work with ColdFusion? Forget what you’ve been told! You actually can use windows/integrated authentication with ColdFusion and SQL Server 2005. Please be reminded that ColdFusion must be running on windows for this to work.
The following shows how to enable this on a CF single server installation. If you are running ColdFusion 8 Enterprise on a mulit-server installation, please be aware that your folder paths *will* be different.
<!–more–>
Step 1- Download the JDBC driver.
Download the SQL Server 2005 JDBC driver and extract it.
Step 2 - Place the files on the server.
There are two files you want to place on the server. The first file is the JDBC driver. It’ll be located at extracted_folder\sqljdbc_1.2\enu\sqljdbc.jar. You’ll want to put this somewhere on the server. I’ve placed mine in the following location - C:\ColdFusion8\lib\thirdpartytools\JDBC\SQLSERVER2005\1.2\.
The second file you’ll want to place on your server is called sqljdbc_auth.dll. This file can be found in extracted_folder\sqljdbc_1.2\enu\auth\x86\sqljdbc_auth.dll (Please note that this folder path is platform specific). Put this file on your server in C:\WINDOWS\system32\. This is the library that the JDBC driver uses to perform integrated authentication.
Step 3 - Add the JDBC class path to ColdFusion
- Login to your ColdFusion Administrator
- Expand Server Settings
- Click on Java and JVM
- Add C:\ColdFusion8\lib\thirdpartytools\JDBC\SQLSERVER2005\1.2\sqljdbc.jar in the ColdFusion Class Path field. Please note that this path may be different depending on where you placed the sqljdbc.jar file on the server.
- Click on Submit Changes
You will be reminded to restart ColdFusion for the changes to take effect. You’ll want to actually reboot your server since we placed the sqljdbc_aut.dll file in C:\WINDOWS\system32\.
Step 4 - Add a user to SQL Server.
The user you’ll want to use for authentication will be the user that the ColdFusion service runs under. By default, ColdFusion runs under the Local System account (you or your system administrator may have changed this). While whether or not this is the best account for CF to run under is up for debate, you can still use it to authenticate to SQL Server as long as it’s the account that ColdFusion is running under. The use this account, the user you’ll want to specify is in the format of DOMAIN\SERVERNAME$ - make sure you use the $ on the end. Obviously, Windows performs some magic on the backend to map this to the Local System account for the server you’re authenticating from.
- Fire up SQL Server Management Studio and connect to the database you wish to use
- Expand Security
- Right click on Logins and select New Login
- For the Login Name, you’ll add the user you want to authenticate with. If ColdFusion is running under the Local System account, try a user in the format of DOMAIN\SERVERNAME$ and see if Windows will do its magic
- (optional step) Click on User Mapping and select the databases and permissions for your user
- Click on OK
Step 5 - Add a datasource to ColdFusion.
- Login to your ColdFusion Administrator
- Click on Data & Services
- Click on Datasources
- Type in a Data Source Name
- For Driver, select Other
- Click on Add
- For the JDBC URL, use the following: jdbc:sqlserver://servername:1433;databaseName=dbname;integratedSecurity=true; (please make sure you substitute the servername and dbname)
- For Driver Class, add: com.microsoft.sqlserver.jdbc.SQLServerDriver
- Click on Submit
You should now be done and have a successful connection.


