Oracle SQL Developer 4.2通过Windows身份验证连接SQL Server失败求助
Let’s walk through the most common fixes for this issue, since you’ve already tried placing the DLLs in standard locations and restarting:
Match DLL bitness to SQL Developer’s JRE
Oracle SQL Developer 4.2 often ships with its own bundled JRE, which might be 32-bit even on a 64-bit system. Double-check the bitness of the JRE SQL Developer is using: go toHelp > Aboutand look for the "Java Version" entry. Make sure thentlmauth.dllyou’re using matches this bitness (32-bit DLL for 32-bit JRE, 64-bit for 64-bit JRE). Placing the wrong bitness DLL in any directory won’t work, even if you restart.Place DLLs in SQL Developer’s bundled JRE directory
If SQL Developer is using its own JRE (not your system JDK/JRE), the DLLs you placed injdk/jre/binor system folders won’t be picked up. Find the bundled JRE path from the About window (it might look like<sqldeveloper_install_dir>\jdk\jre), copyntlmauth.dllinto itsbinsubfolder, then restart SQL Developer.Verify your connection configuration
Ensure your SQL Developer connection is set up correctly for Windows Auth with jTDS:- When creating a new MS SQL connection, select
jTDSas the driver. - Check the box for Use Windows Authentication.
- If you’re on a domain, add the
domainparameter to your connection string (or fill the Domain field in the connection UI). You can also try addinguseNTLMv2=trueto the connection properties to force newer NTLM authentication, which is often required for modern Windows domains.
Example connection string:
jdbc:jtds:sqlserver://<your_server>:1433/<your_database>;domain=<your_domain>;useNTLMv2=true- When creating a new MS SQL connection, select
Test DLL loading with a simple Java program
To confirm if the DLL is being loaded correctly, create a quick test program using the same JRE that SQL Developer uses. Compile and run it to see if you get a clear error message (likeUnsatisfiedLinkErrorif the DLL is missing or mismatched):import java.sql.Connection; import java.sql.DriverManager; public class JtdsAuthTest { public static void main(String[] args) { try { Class.forName("net.sourceforge.jtds.jdbc.Driver"); Connection conn = DriverManager.getConnection( "jdbc:jtds:sqlserver://your_server:1433/your_db;domain=your_domain;useNTLMv2=true" ); System.out.println("Connection successful!"); conn.close(); } catch (Exception e) { e.printStackTrace(); } } }Run this with the JRE from SQL Developer (e.g.,
<sqldeveloper_jre_path>\bin\java.exe JtdsAuthTest). The error output will point you directly to whether the DLL issue is the root cause.Check SQL Server settings
Make sure SQL Server is configured to allow Windows Authentication (open SQL Server Management Studio, go to Server Properties > Security > Server authentication, confirm "Windows Authentication mode" is selected). Also, verify that your Windows user has permissions to access the target database, and that the SQL Server TCP/IP protocol is enabled (in SQL Server Configuration Manager).
内容的提问来源于stack exchange,提问作者Athar Iqbal

