I am trying migrate data
- from an old database, that I can access through the Azure Interface,
- to a new postgres db, in a Ruby on Rails app
To try and access the Azure database, using SQL server authentication, I'm calling a service, following Microsoft's documentation
azure_export_service.rb
require 'tiny_tds'
class AzureExportService
attr_accessor :client
def initialize
self.client = TinyTds::Client.new(
username: Rails.application.credentials.azure.username,
password: Rails.application.credentials.azure.password,
database: Rails.application.credentials.azure.database,
host: Rails.application.credentials.azure.server,
port: 1433,
azure: true
)
end
def call
tsql = 'SELECT * FROM [dbo].[Country];'
result = client.execute(tsql)
result.each do |row|
puts row
end
result
end
end
I keep getting this timeout error when I'm trying to open a connection
TinyTds::Error: Adaptive Server connection timed out (<mydb>.database.windows.net)
The credentials I am using are the same ones Azure is providing in the database connection strings. I have tried running the Troubleshooting powershell script provided by Microsoft, using those same credentials. It has no problem connecting to the server and database. It is however reporting "redirect conectivity" as failing (might this be the reason ?)
I tried added firewall rules to the Azure SQL Server to allow my IPv4 adress, but to no effect.
Could anyone tell me what I might be doing wrong ?
Thank you very much
What I'm trying:
Connecting to an azure SQL Database, using Ruby (TinyTDS)
Expecting:
A successful connection
What happenned:
A Timeout error
TinyTds::Error: Adaptive Server connection timed out (<mydb>.database.windows.net)