Azure / azure-sql-database-samples

Azure SQL Database Samples and Reference Implementation Repository
Other
820 stars 370 forks source link

TinyTds::Error: Adaptive Server connection failed #12

Open monteirobrena opened 8 years ago

monteirobrena commented 8 years ago

I'm trying to configure my Rails project with SQL on Azure. I'm using Mac OS X 10.11. But when I run rake db:migrate I receive this error TinyTds::Error: Adaptive Server connection failed.

I'm looking for answer in Stackoverflow, too.

http://stackoverflow.com/questions/36484700/rails-and-azure-tinytdserror-adaptive-server-connection-failed

meet-bhagdev commented 8 years ago

+Andrea

On Thu, Apr 7, 2016 at 11:56 AM -0700, "Brena Monteiro" notifications@github.com<mailto:notifications@github.com> wrote:

I'm trying to configure my Rails project with SQL on Azure. I'm using Mac OS X 10.11. But when I run rake db:migrate I receive this error TinyTds::Error: Adaptive Server connection failed.

I'm looking for answer in Stackoverflow, too.

http://stackoverflow.com/questions/36484700/rails-and-azure-tinytdserror-adaptive-server-connection-failedhttps://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fstackoverflow.com%2fquestions%2f36484700%2frails-and-azure-tinytdserror-adaptive-server-connection-failed&data=01%7c01%7cmeetb%40microsoft.com%7c75104fd7e99f44f0c86d08d35f165411%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=9XjWh7%2f%2bTigSIczghqFKgLaWgyjugCrhzkMXoe28CqQ%3d

You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHubhttps://github.com/Azure/azure-sql-database-samples/issues/12

ajlam commented 8 years ago

@monteirobrena Are you able to connect to your Azure SQL Database any tools outside of your Rails app? What happens when you run rake db::setup?

monteirobrena commented 8 years ago

I fixed it, but I need change my config/database.yml.

staging:
  adapter: sqlserver
  username: 'username@database'
  password: 'password'
  host: 'db-staging.database.windows.net'
  port: 1433
  database: 'db-staging'
  azure: true
monteirobrena commented 8 years ago

@ajlam actually works fine in localhost but now when I move to staging (Ubuntu VM Azure) the same error occurred.

TinyTds::Error: Adaptive Server connection failed
monteirobrena commented 8 years ago

That's so weird! If I setup this configuration as development database, all work correctly. I can connect and save in my database on Azure. But when I try to deploy to staging VM with Capistrano I receive this error

$ cd /var/www/homepage/releases/20160408035644 && ( export RAILS_ENV="staging" ; ~/.rvm/bin/rvm default do bundle exec rake db:migrate )

rake stdout: rake aborted!
TinyTds::Error: Adaptive Server connection failed
/var/www/homepage/shared/bundle/ruby/2.2.0/gems/tiny_tds-0.7.0/lib/tiny_tds/client.rb:74:in `connect'
/var/www/homepage/shared/bundle/ruby/2.2.0/gems/tiny_tds-0.7.0/lib/tiny_tds/client.rb:74:in `initialize'
ajlam commented 8 years ago

@monteirobrena Let me test with staging on my end to see if I run into a similar error.

monteirobrena commented 8 years ago

@ajlam any news?

I put my project in my staging server and if I run rails s inside this folder I can connect with my database. But, if I run my project with Puma and Nginx, I receive this error:

TinyTds::Error (Adaptive Server connection failed):

ajlam commented 8 years ago

@monteirobrena sorry for the delay. Still working on trying to repro the issue. I'll try to get back to you asap.

ajlam commented 8 years ago

@monteirobrena were you able to figure out what the problem was?

monteirobrena commented 7 years ago

@ajlam not yet.

I'm receiving this error:

[TinyTds][v1.0.2][tsql]: /usr/local/bin/tsql locale is "en_US.UTF-8" locale charset is "UTF-8" using default charset "UTF-8" Setting db-api-staging as default database in login packet 2Error 20002 (severity 9): Adaptive Server connection failed OS error 60, "Operation timed out" There was a problem connecting to the server