Connection con = DriverManager.getConnection("jdbc:sqlserver://dataserver:1433; DatabaseName=database", username, password);
It works well.
After my company update the database to SQL SERVER 2005 using Windows Authentication. My program sucks.
I want to know the format of JDBC connectivity code for Windows Authentication, as similar as the code I post above? Anyone can help me?
Hi there,
As far as I am aware, the SQL Server 2005 JDBC driver does not currently support Windows Authentication. Checking out the documentation I found here seems to indicate that Windows Auth doesn't work as setting the integratedSecurity property to "true" (implying Windows Auth) produces an exception.
You could try jTDS (http://jtds.sourceforge.net/faq.html). The project seems to be dead at the moment but you can still download the required files. It supports Windows Auth and in the connection string you have to use the domain property and specify what domain you are on (same domain as the SQL Server you are trying to connect to, of course).
The relevant information is all in the FAQ (the jTDS link I gave above).
Good luck & sorry I couldn't be of more help at the mo.
No comments:
Post a Comment