Detect ms sqlserver status

Hi There
I just want to use ruby script to detect if the MS SQLserver works
well/status, beside use "connected", is there any other better method?
thanks.

···

--------------------
require 'dbi'

@server_name='localhost'
@dbh=DBI.connect("DBI:ADO:Provider=SQLNCLI;Data
Source=#{@server_name};Integrated Security=SSPI")

if @dbh
  puts "connected"
else
    puts "not connected"
end

--
Posted via http://www.ruby-forum.com/.

<SNIP>
you can try to run some specific query that results a specific result to make sure the server is serving data.
what data do you need on the server?

Eliezer

···

On 7/13/2012 9:32 AM, Edward QU wrote:

Hi There
I just want to use ruby script to detect if the MS SQLserver works
well/status, beside use "connected", is there any other better method?
thanks.

--
Eliezer Croitoru
https://www1.ngtech.co.il
IT consulting for Nonprofit organizations
eliezer <at> ngtech.co.il

Eliezer
Thanks for your reply, actually, I just want to know if this sql server
is live well or locked.

Edward

···

--
Posted via http://www.ruby-forum.com/.

what locked means? Locked on a firewall level?
if so you can use the tcp-ping or just plain TCPclient socket and verify it almost the same way you have done.
it will just make it in a lower level that requires only socket and not dbi.

Eliezer

···

On 7/14/2012 8:33 PM, Edward QU wrote:

Eliezer
Thanks for your reply, actually, I just want to know if this sql server
is live well or locked.

Edward

--
Eliezer Croitoru
https://www1.ngtech.co.il
IT consulting for Nonprofit organizations
eliezer <at> ngtech.co.il