r/SQLServer • u/Rocknbob69 • Sep 29 '25
Question JDBC Connection error to SQL Server
I am getting the following message every minute on a restored VM running SQL.
"Login failed for ''. Reason: An attempt to login using SQL authentication failed. Server is configured for Windows Authentication only. [Client Localhost]
Nothing has changed in regards to allowed authentication methods. I can log in either way using Windows credentials or an sa account from SQL Management studio.
There are also weird issues during a restart of all of the associated services and one service not starting or staying running.
5
Upvotes
2
u/SirGreybush 1 Sep 29 '25
Looks a new MSSQL install that’s not configured for mixed mode authentication. Only AD (part of the domain) user or group.
But your client connection is trying to log in with with SQL login not AD login.
Visit https://www.connectionstrings.com/sql-server/
If you really need SQL logins, you have to rerun the installation from the ISO installer and configure mixed mode, or, try a Microsoft webpage showing how to do after the install.
https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/change-server-authentication-mode?view=sql-server-ver17&tabs=ssms
You can test this with SSMS version 21, free download from Microsoft. Put on that same PC and test there.
Retest on the server console.
To debug the issue properly. Either certificate problem, network problem, mixed mode not enabled…
1
u/Paper-Superb Sep 29 '25
I ran into this a while back, turns out changing all the db secrets in my secret manager pipeline, fixed it, idk why. it was weird
1
u/jshine13371 6 Sep 29 '25
That would likely be due to an automated process running every minute with an account that it can't authenticate with. Commonly a SQL Agent Job, if you happen to use those. Look at which scheduled processes that you have which run every minute and that should help narrow down the source trying authenticate.
2
u/dlevy-msft Microsoft Employee Sep 29 '25
Do you have TCP enabled for the instance? You should be able to check that quickly in SQL Configuration manager.
1
u/Menthalion Sep 29 '25 edited Sep 29 '25
What type of account do you use to connect to this database ? Windows or SA ? And what operating system ?
If the restored SQL server is Windows 2008 or 2012, the accepted cyphers for the connection might not be accepted by the OS on the client side anymore.
From JDBC 10.2 upward you also need to either specify the certificate you want to use to encrypt the SQL server traffic with, or if you want to accept the on-the-fly created certificate the SQL server makes if no certificate has been installed. You can do this by adding ";trustServerCertificate=true" to the JDBC connection string, or set the appropriate property to true in code.