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
While I've played around with rails a bit before, my rails knowledge is definitely limited and I've never set up a connection to an MS SQL server or used the TinyTds gem, therefore I suspect that I simply didn't configure my environment correctly. Hence my post here. I'd really appreciate if one of you rails experts could take a look at the database config. The information I could find regarding configuring rails to connect to named instance combined with a non-standard SQL port were limited.
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.
In case anyone stumbles upon this, leaving out the instance does the job.