Hi, this is the code i've tried:
require 'dbi'
class Server
attr_reader :name
def initialize(name)
@server_name=name
@dbh=DBI.connect("DBI:ADO:Provider=SQLNCLI;Data
Source=#{name};Integrated Security=SSPI")
end
def databases
db=Array.new
@dbh.select_all('SELECT name FROM master.sys.databases ORDER BY 1') do
| row |
db.<< Database.new(@dbh,row[0])
end
db
end
end
class Database
attr_reader :name
def initialize(dbh,name)
@dbh=dbh
@name=name
end
end
server=Server.new("localhost")
server.databases.each {|x| p x.name}
Chris McMahon <[EMAIL PROTECTED]> wrote:
class Server
attr_reader :name
def initialize(name)
@server_name=name
@dbh=DBI.connect("DBI:ADO:Provider=SQLNCLI;Data
Source=#{name};Integrated Security=SSPI")
end
def databases
db=Array.new
@dbh.select_all('SELECT name FROM master.sys.databases ORDER BY 1') do
| row |
db.<< Database.new(@dbh,row[0])
end
db
end
end
class Database
attr_reader :name
def initialize(dbh,name)
@dbh=dbh
@name=name
end
end
server=Server.new("localhost")
server.databases.each {|x| p x.name}
Chris McMahon <[EMAIL PROTECTED]> wrote:
require 'odbc'
c = ODBC::connect('odbc database name, 'user', 'password')
data = "" * FROM FOO")
data.each do |record|
puts record
end
c.disconnect
Post the code you tried with, please.
-Chris
On 6/19/06, jet ibaÿfffff1ez <[EMAIL PROTECTED]>wrote:
>
> I'm having a problem with one of the projects i'm handling right now. I was
> asked to create automation scripts using watir that could also access SQL
> Server 2000.
> Can anybody help me out with this???
> I've read some of the posts here regarding database connectivity but it
> doesn't seem to work and I can't figure out how I can make them to work.
> Please help me out guys. Thanks in advance...
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
>
>
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
Send instant messages to your online friends http://uk.messenger.yahoo.com
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
