I try to connect to the database using MS SQL Server as subd. I downloaded and installed the driver, added it to the project. Set the url:

jdbc: sqlserver: // localhost \ SQLEXPRESS; databaseName = ApartmentsSystem; integratedSecurity = true;

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); connection = DriverManager.getConnection(URL); 

When trying to connect writes:

Login failed. The login belongs to an untrusted domain and cannot be used in Windows authentication. ClientConnectionId: f9544554-eba8-4405-81e2-3194aa72295f

Can anyone tell me what the problem is? Maybe something else you need to configure in the driver for the subd?

    1 answer 1

    In general, integratedSecurity = true means windows authentication, as I understand it, you obviously need to set a user and password for authentication (for some reason, I don’t want to use windows authentication), for this I used sql authentication (integratedSecurity = false), I explicitly registered a user and password. And everything is fine.