I am trying to connect to SQL Server 2008 using 'sa' username and its password. In the SQL Server log file I see this error:
Login failed for user 'sa'. Reason: An attempt to login using SQL authentication failed. Server is configured for Windows authentication only.
When I right-clicked on the server -> Properties -> Security "SQL Server and Windows authentication mode" is chosen.
I thought it's a problem with the 'sa' user so I did:
ALTER LOGIN sa ENABLE ;
GO
ALTER LOGIN sa WITH PASSWORD = '<enterStrongPasswordHere>' ;
GO
But it didn't help.
What else can it be?
Check out Windows or Mixed authentication mode is enabled. For that, select the database, right click on it, and choose “Properties”. In the Security tab, check out the server authentication section. If the authentication mode is changed, then do not forget to restart SQL Server to allow changes to take place.
Open SQL Server Management Studio. In Connect to Server, select Database Engine, enter your SQL Server name, and enter administrator credentials to connect to the server. Select Connect. In Object Explorer, expand the SQL Server, expand Security, right-click Logins, and then select New Login.
It looks like you will need to restart your SQL Server according to the MSDN link on enabling Mixed-Mode Authentication
There is another article (user comment at the bottom) referencing a registry key that you can look at; it also says you will need to restart the service once you have changed it.
From the first link:
To change security authentication mode:
In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
In the SQL Server Management Studio dialog box, click OK to acknowledge the requirement to restart SQL Server.
To restart SQL Server from SQL Server Management Studio
You have to enable mixed mode server authentication:
After much research, I was able to connect my netbeans to my microsoft server.
If you registered your server as window authentication, you have to create another login which should be SQL Server Authentication, this will prompt you to input your username and password, create new, if you don't have any already existing login.
Map your new login to any database, preferably Master or Adventure...
Go to server manager configuration tool in your MSSQL folder in the start up menu,
Manager configuration tools ---> SQL Server services -----> select your server instance from the right pane, select MSSQLSERVER or MSSQLEXPRESS
whichever you know is your instance, preferably, work on the two of them, one after the other.
MSSQLSERVER express ---->under security----> Startup Parameters----> specify a parameter ---> type -m in the box ----> click on ADD.
CLick APPLY, then OK.
Do same to the MSSQLEXPRESS.
Restart the two of them Go back to your SQL management studio, Connect to server, select SQL SERVER AUTHENTICATION Input your username and password, then ok.
Open your netbeans, right click your database, do your new connection stuff with the JDBC driver, input your login details of the SQL server...... connect.
It works perfectly well.
Remember to enable your TCP/IP Port remains 1433
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With