Thursday, January 12, 2012

Connect to SQLServer with out any username/password

Here is the steps
- Download your sqljdbc.jar driver (it can be X86 and x64 )
-file name : sqljdbc_2.0.1803.100_enu.zip
- Extract it and get the sqljdbc_auth.dll from above file
place sqljdbc_auth.dll file inside the C:\WINDOWS\system32 directioy
Now u r ready for connection

Now in your java file
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String server="localhost";
Class.forName(driverName);
dbConn =java.sql.DriverManager.getConnection("jdbc:sqlserver://"+server+":1433;Database=tempdb;integratedSecurity=true");

Here integratedSecurity=true will help you to connect the sqlserver with out authentication 

No comments:

Post a Comment