i don't know if you went with an active record solution, i just saw this
thread, but i've been using the gem Sequel as part of my watir tests (
http://sequel.jeremyevans.net/) for a while now and found it has very good
sqlserver support. I has a concept of models like AR, but for the most part
i just run queries using it's dsl. It's also simple to connect to a db:
require 'sequel'
DB= Sequel.connect(
:adapter => 'ado',
:host =>server,
:database => db,
:user => 'user',
:password => password'
)
You can either use the dsl (DB[:table].where(:column =>
'value').select(:column, :column2) or just do raw sql queries (which i do
for for sproc execution mostly) ( DB.fetch("exec Sproc_Name @param=
:param", :param => 'value') do |n|
array << n[:name]
end)
On Tuesday, November 12, 2013 5:58:21 AM UTC-8, gary wrote:
>
> HI,
>
> Back in the days of Watir 1.8.6 it was fairly straightforward to connect
> to your sql database using dbi and odbc which was packaged with the watir
> installation.
>
>
> require 'odbc'
> require 'dbi'
> @dbconnect = 'DBI:ODBC:my odbc connection'
> @dbuser = 'username'
> @dbpass = 'password'
>
> @dbh = DBI.connect(@dbconnect, @dbuser, @dbpass)
>
> @sth = @dbh.prepare("select whatever from wherever i want")
> @sth.execute
> @details = Array.new
> @count = 0
> while [email protected] do
> @details[@count] = row.to_s
> @count +=1
> end
> @totalrows = @count
> @sth.finish
>
>
>
>
> The newer versions of watir (2.1) don't appear to have anything packaged
> to do this and I'm struggling with the mass of google groups, blogs etc to
> keep up and figure out how to do this, not only is it all a mass of
> confusion but nothing appears to install without being directed to yet
> another gem to install, which often results in further gem installations,
> so if anyone has any basic instructions they can post, preferably as close
> to the odbc route i was previously using that would be greatly appreciated.
> My good old trusty stuck in the dark ages of watir 1.8.6 still works a
> treat but unfortunately the browser interaction does not ;-(
>
> Many thanks, Gary
>
--
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]
---
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.