Sql server 使用Ruby中的tiny_tds通过SSH隧道连接到SQL Server

Sql server 使用Ruby中的tiny_tds通过SSH隧道连接到SQL Server,sql-server,ruby,tiny-tds,Sql Server,Ruby,Tiny Tds,我尝试通过SSH隧道使用Ruby gem连接到远程SQL Server 2008 R2,如下所示: require 'tiny_tds' require 'net/ssh/gateway' gateway = Net::SSH::Gateway.new( 'host', 'username', port: 'port', password: 'password' ) port = gateway.open('127.0.0.1', 1433, 1234) # SQL Serve

我尝试通过SSH隧道使用Ruby gem连接到远程SQL Server 2008 R2,如下所示:

require 'tiny_tds'
require 'net/ssh/gateway'

gateway = Net::SSH::Gateway.new(
  'host',
  'username',
  port: 'port',
  password: 'password'
)
port = gateway.open('127.0.0.1', 1433, 1234) # SQL Server uses 1433 port

db_client = TinyTds::Client.new(
  host: '127.0.0.1',
  username: 'username',
  password: 'password',
  port: 1234,
  database: 'database'
) # => TinyTds::Error: Adaptive Server connection timed out (127.0.0.1:1234)
我得到了上面的例外。尽管如此,如果我尝试从控制台SSH到Windows机器,并尝试使用
sqlcmd
连接到SQL服务器,那么一切正常