Reputation: 11
I'm using Tiny TDS in Windows 7 64bits.
Configs:
Ruby: 1.9.3
Rails: 4.0.0
Tiny TDS: 0.6.1
database.yml
development:
adapter: sqlserver
host: localhost
dataserver: PAVEI-PC\PAVEI
database: TKD_SUBD
username: pavei
password: pavei
in rails console
client = TinyTds::Client.new(:username => 'pavei', :password => 'pavei', :dataserver => 'PAVEI-PC\PAVEI', :database => 'TKD_SUBD')
irb(main):003:0* client.execute("teste")
TinyTds::Error: closed connection
from (irb):3:in `execute'
from (irb):3
I dont know why connection is closed!
Upvotes: 1
Views: 746
Reputation: 235
Your configuration file is not right. As is mentioned in TinyTds Readme, :host
must be used only if :dataserver
is blank, and you have both there. But the execution command in the console is correct.
I have same problem, the connection is closed just after client is created, and this happens only when I use :dataserver
instead :host
Works:
client = TinyTds::Client.new username: 'sa', password: 'secret', host: '192.168.0.74', database: 'MyDB'
Doesn't work (connection is closed):
client = TinyTds::Client.new username: 'sa', password: 'secret', dataserver: 'MYNTBK\SQLEXPRESS', database: 'MyDB'
Upvotes: 1