java.lang.UnsatisfiedLinkError: com.microsoft.sqlserver.jdbc.AuthenticationJNI.GetDNSName
使用 integratedSecurity=true (Windows 整合驗證) 時,JDBC 驅動需載入原生庫 sqljdbc_auth.dll,但該 DLL 不在 Java Library Path 中。
sqljdbc_auth.dll(分 x86、x64 版本,需與 JRE 位數一致)。%JAVA_HOME%/bin%WINDIR%/System32 (64 位) 或 SysWOW64 (32 位)-Djava.library.path=你的DLL目錄jdbc:sqlserver://localhost:1433;databaseName=YourDB;integratedSecurity=true;若環境不允許放置原生 DLL,改用 SQL Server 帳號密碼驗證:
String url = "jdbc:sqlserver://localhost:1433;databaseName=YourDB;user=sa;password=yourPwd;";
並移除 integratedSecurity=true,即可避免原生庫依賴。