MSSQL Setup - TinyTds::Error: closed connection

Added by Snot Mc Booger 2 months ago

Solved, see at the bottom.

Good evening,

I'm currently trying to setup a Redmine installation for our team. I can't seem to establish a connection to our MSSQL server from within rails.

$ RAILS_ENV=production bundle exec rake db:migrate
rake aborted!
TinyTds::Error: closed connection
/home/admin/.rbenv/versions/2.6.6/bin/bundle:23:in `load'
/home/admin/.rbenv/versions/2.6.6/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

I installed sqlcmd to test the connection outside out rails, and I managed to login and create and drop a table as a test. I suspect it's my database.yml. I have to connect to an MS SQL Instance, and the server in running on a different port. Tried to tweak around with the settings a bit, but couldn't get it working.

database.yml
production:
adapter: sqlserver
database: Redmine01
dataserver: server\instance
port: ####
username: user
password: "password"
encoding: utf8mb4

As a sidenote, for sqlcmd I used "-S server\\instance,####" to establish the connection. Which I've surely tried in the database.yml too, but without any success.

I'd really appreciate any input from the experts, since we'd love to start using your tool beginning next week. I'm happy to provide any further information regarding the server configuration.

Solved:

In case anyone stumbles upon this, leaving out the instance does the job.

production:
adapter: sqlserver
database: Redmine01
dataserver: server
port: ####
username: user
password: "password"