建立连接:
Connection conn=(Connection)DriverManager.getConnection("jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=YourDatabaseName");
出现错误:
Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path或者
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.microsoft.sqlserver.jdbc.AuthenticationJNI.GetDNSName(Ljava/lang/String;[Ljava/lang/String;Ljava/util/logging/Logger;)I
解决办法:将sqljdbc_auth.dll拷贝到C:\Windows\System32目录下即可解决
本文介绍了在使用Java连接SQL Server数据库时遇到的连接失败问题及其解决方案。主要原因是sqljdbc_auth.dll未找到或未正确加载。文章提供了具体的解决步骤:将sqljdbc_auth.dll文件复制到C:WindowsSystem32目录下。
2000

被折叠的 条评论
为什么被折叠?



