I was installing a new instance of SQL Server 2018 on my machine today and had some initial trouble getting Ruby to connect. Installer completed fine, connected to the server with Microsoft SQL Server Management Studio and created a new database - everything seemed good.
I then jumped over to the Ruby application, set the environmental variables for the database and attempted to run the migrations. Failed to connect…
By default, Windows SQL server only enables Shared Memory for communicating to the server. To get SQL Server to listen to external applications on a port, TCP/IP needs to be enabled. To do this
- Open SQL Server Configuration Manager
- Select SQL Server Network Configuration -> Protocols for MSSQLSERVER
- Enable TCP/IP
- Restart the SQL Server service
Other applications like Ruby will now be able to connect SQL Server. This is most likely a basic thing that most devs would probably know but it stumped me for a little while.