I am using Tomcat as my servlet engine and IIS as the Server. Additionally, I am using MS SQL 2000 as my DB. The DB resides on a seperate machine, and have created an ODBC JDBC connection on the local machine to access it. Additionally, the authentication for the DB is set to "Windows Authentication".
Everything works fine if I simply run tomcat and access the databse. Also, things run fine when I run tomcat via IIS too. However, when I try accessing the database, I get the error
Login failed for user '<username>'
Now, the funny part is, this username is actually the username of the local machine on which the application has been placed. It is not the username that I am providing in
Can someone please help me figure it out?? Why is it working when I run the tomcat (Apache) and run the application from there, but ones I run it via IIS, it fails. Also, why is it taking the username from the local machine and not the one that I am providing out there?
Hi If i understand you correctly you wanna use Windows authentication but it is not possible (at least with JDTS which i used). you just can use MS SQL server with MIXED mode or SQL server authentication mode to access the db from Java.
Thanks for the reply. So, even if I put it as SQL Server and Windows Authentication, i will still have to use SQL Authentication ONLY?
However, I am still baffled by one thing. Presume the name of the computer is CompName and domain it is in is myDomain. Now, even though I have logged onto to it through the user name XYZ, the error says -
Login failed for user myDomain/CompName
Why is it not stating that login failed for user XYZ. XYZ happens to be the owner of that database too on the SQL Server.
Sounds like it is still configured to use Windows Authentication. Are you sure you have changed the authentication settings? Also can you show us how you are logging in?
Irfan E. Khan
Joined: Jun 30, 2005
Yes, its still configured to run on Windows Authentication only. I have to wait for the DB Admin to be here to change the settings for it. It should be done in an hour's time and I will post the status / logs for you.
Please bear with me. Thanks!
subject: JDBC Connection to MS SQL with Windows Authentication