Re: [Wtr-general] manipulating dos prompt with watir
alan wrote: > In my watir script i would like to have it go to open a dos command window > and start sqlplus, then run a simple query to see if a member exists, the > flow would be something like: > open cmd.exe > log in as [EMAIL PROTECTED] > pass the password somewhere around here > do query select * from members where name = 'testername' > if cmd contains(testername) > puts 'yay' > else > puts 'drat' > end > > is this easily done? so far after spending most of the day in google and > trying some different ideas I still have nothing. suggestions? > i'm new to sql and watir, but since i did make watir send results to and > excel file I figure this must also be doable. > You should use Ruby's system command to directly call sqlplus and put your commands in a file that is then passed as an argument to sqlplus. You will need to refer to the sqlplus command line documentation for details on how to do this. I am currently using this approach to run scripts using sqlcmd, which is the SQL Server corolate to Oracle's sqlplus. Some other people have suggested other methods for accessing a database, which you may also want to experiment with, but this approach will probably be the easiest for you. Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] manipulating dos prompt with watir
you dont need to use sqlplus - use the ruby dbi module - Original Message - From: alan <[EMAIL PROTECTED]> Date: Monday, April 30, 2007 6:21 pm Subject: [Wtr-general] manipulating dos prompt with watir > In my watir script i would like to have it go to open a dos > command window and start sqlplus, then run a simple query to see > if a member exists, the flow would be something like: > open cmd.exe > log in as [EMAIL PROTECTED] > pass the password somewhere around here > do query select * from members where name = 'testername' > if cmd contains(testername) > puts 'yay' > else > puts 'drat' > end > > is this easily done? so far after spending most of the day in > google and trying some different ideas I still have nothing. > suggestions?i'm new to sql and watir, but since i did make watir > send results to and excel file I figure this must also be doable. > ___ > Wtr-general mailing list > Wtr-general@rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] manipulating dos prompt with watir
Look up ruby "system" or "exec" commands. Also consider connecting to the DB directly with ODBC or DBI. -Chris On 4/30/07, alan <[EMAIL PROTECTED]> wrote: > In my watir script i would like to have it go to open a dos command window > and start sqlplus, then run a simple query to see if a member exists, the > flow would be something like: > open cmd.exe > log in as [EMAIL PROTECTED] > pass the password somewhere around here > do query select * from members where name = 'testername' > if cmd contains(testername) > puts 'yay' > else > puts 'drat' > end > > is this easily done? so far after spending most of the day in google and > trying some different ideas I still have nothing. suggestions? > i'm new to sql and watir, but since i did make watir send results to and > excel file I figure this must also be doable. > ___ > Wtr-general mailing list > Wtr-general@rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] manipulating dos prompt with watir
In my watir script i would like to have it go to open a dos command window and start sqlplus, then run a simple query to see if a member exists, the flow would be something like: open cmd.exe log in as [EMAIL PROTECTED] pass the password somewhere around here do query select * from members where name = 'testername' if cmd contains(testername) puts 'yay' else puts 'drat' end is this easily done? so far after spending most of the day in google and trying some different ideas I still have nothing. suggestions? i'm new to sql and watir, but since i did make watir send results to and excel file I figure this must also be doable. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general