Unable to connect with MSSQL
See original GitHub issueI’ve modified settings.json as follows to enable MSSQL as the database storage technology.
I’m using a default, unnamed, installation of MSSQL. Port 1433 isn’t redirecting correctly for some reason, but I determined that it’s listening on 1434 by using the script below.
There was an issue with self signed certificates (ConnectionError: Failed to connect to (server name here) - self signed certificate
) which was resolved by adding trustServerCertificate: true
.
At this point it’s failing with ConnectionError: Login failed for user 'eptest'.
I think this might be more on the node side rather than the database server, because I can connect to the MSSQL server using SSMS with the user’s credentials and the user can access the configured database. I browsed through various js files related to connections and the connection pool, and the mssql implementation in ueberdb2 specifically, but nothing jumped out at me.
I added a firewall exception, just in case that was the issue, as described here: https://docs.microsoft.com/en-us/sql/sql-server/install/configure-the-windows-firewall-to-allow-sql-server-access?view=sql-server-ver15#BKMK_dynamic_ports
Any suggestions? Is there any way to turn on more verbose logging?
Settings.json snippet
/*"dbType": "dirty",
"dbSettings": {
"filename": "var/dirty.db"
},*/
"dbType": "mssql",
"dbSettings": {
"user": "eptest",
"password": "user's password here",
"host": "localhost",
"port": 1434,
"database": "etherpad_lite_db",
"options": {
"trustServerCertificate": true
}
},
For future users, here’s the script to find the port that MSSQL is listening on:
USE master
GO
xp_readerrorlog 0, 1, N'Server is listening on'
GO
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (6 by maintainers)
Well you are doing great 😃
If the changes require changes to source code or docs within the repository (README.md etc)then you would make a PR. If the docs are just within the wiki, they are editable without any peer review.
This item can be closed. I’m still working on windows in parallel to you btw, it is something we will fix in core that wont require any windows hackery.
@JohnMcLear I have Etherpad up and running on my Windows dev box using MSSQL! Below are my debugging notes, which will hopefully help someone else (or me!) in the future. Thank you again for your help!
I didn’t know this existed, but there are great SQL Server logs that might be useful to people who are diagnosing this issue. https://docs.microsoft.com/en-us/sql/relational-databases/performance/view-the-sql-server-error-log-sql-server-management-studio?view=sql-server-ver15
In my case, I’m seeing two errors for each login attempt:
This lead me to: https://dba.stackexchange.com/questions/214374/login-lacks-connect-endpoint-permission-in-sql-server-error-18456-state-149
In SQL Server, run this. You should have at least one record returned. I have a record, so IDK what to do if you don’t, but that is something to look into.
Following that, I granted CONNECT permissions for the
TSQL Default TPC endpoint
. First I granted to only this SQL user and then I granted to public; neither resolved the issue.Maybe your TCP/IP connection is disabled. This was my problem. I have a default installation of developer edition of MSSQL that I just set up this week. I’ve been using SQL Server with ASP.NET, services, Winforms, WPF, etc for 15 years and I’ve never had reconfigure this. I believe that SSMS will usually connect with named pipes rather than a local TCP/IP connection, so testing the login credentials with SSMS was not a valid test.
Use the ‘SQL Server Configuration Manager’, go to the network configuration section and confirm that
TCP/IP
is enabled (enable it if you need to). Open the properties ofTCP/IP
and confirm thatIP4
is active and take note of the configuredPort
.After making these changes, I adjusted my connection configuration to use the correct and default port, 1433, and the SQL user was able to connect in both the MVP test and in etherpad.