lundi 21 septembre 2015

Ruby TinyTDS client

Here is the code:

client = TinyTds::Client.new username: 'sa', password: 'secret', host: 'mydb.host.net, database: MYDB, dataserver: MYDS'

I want to test the connection and report if it is alive or not

if client.active?
  puts "Connection to #{client.database} on #{client.dataserver} is alive"
else
  puts "Unable to establish connection to #{client.database} on #{client.dataserver}"
end

Here is the error:

<main>': undefined method `database' for #<TinyTds::Client:0x007f8b9384d840> (NoMethodError)

If client is an object, how do I access database and dataserver?

Thanks!

Aucun commentaire:

Enregistrer un commentaire