简体   繁体   中英

Remotely connect to SQL Server through Java from an untrusted domain with Windows authentication

I am trying to remotely connect to SQL Server from a remote machine on an untrusted domain (I am not on the same domain as the host with the SQL server). The SQL Server is using Windows authentication and I can't change that. I am not allowed to make any manual changes to that remote machine like using SQL authentication. I can't add my machine to trusted domain(At least not manually). Currently using WMI I am able to access registry, etc. I know using runas /netonly command I can pretend I am on that machine but I can't use this command as it has to be all Java. I know with WMI I'll be able to connect to that machine having its ip/password and get different type of information but is there away to run SQL queries and all as well? Or any other solution using Java? PS currently of course, I am getting "com.microsoft.sqlserver.jdbc.SQLServerException: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication." Thank you.

I couldn't connect to SQL Server through Java remotely when not being in the same domain and only having the Windows Authentication option. So I ended up changing the security option manually in SQL Server management Studio to both using SQL user and Windows Authentication. This way I could connect to it using the SA!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM