Re: Anyone using Ruby for scripting?

  • From: Waldirio Manhães Pinheiro <waldirio@xxxxxxxxx>
  • To: orasnita@xxxxxxxxx
  • Date: Thu, 16 Sep 2010 07:53:57 -0300

   Hello friends, good morning

  You could use the GnuWin Packages (http://gnuwin32.sourceforge.net/) in
your machines that you want run bash scripts. Don't  will be necessary
change your scripts and if you don't know Perl, will be easier to you.

Cheers
Waldirio

On Thu, Sep 16, 2010 at 3:56 AM, Octavian Rasnita <orasnita@xxxxxxxxx>wrote:

> I recommend Perl.
>
> Not only that it is very flexible and you can use Oracle very easy with it,
> but you will also have access to the dozens of thousands of Perl modules you
> can install from CPAN that might also help you to do many things even
> easier.
>
> A program that access an Oracle database could look like:
>
> use DBI;
>
> my $dbh = DBI->connect("dbi:Oracle:host=10.10.10.10;sid=orcl", "username",
> "password");
>
> my $sth = $dbh->prepare("insert into users(name, email) values(?, ?)");
>
> $sth->execute('John', 'me@xxxxxxxx');
> $sth->execute('Brian', 'b@xxxxxxxx');
>
> my $sth2 = $dbh->prepare("select name, email from users where locality=?");
> $sth2->execute('Erevan');
>
> while (my $row = $sth2->fetchrow_hashref) {
> print $row->{NAME}, "|", $row->{EMAIL}, "\n";
> }
>
> Or you will be able to use an ORM like DBIx::Class and after generating the
> Perl classes for your database schema say... MyDB::Schema using a command,
> you will need to use a code like:
>
> use MyDB::Schema;
>
> my $schema = MyDB::Schema->connect("dbi:Oracle:host=10.10.10.10;sid=orcl",
> "username", "password");
>
> my $users = $schema->resultset("Users");
>
> $users->create({
>  name => 'john',
>  email => 'me@xxxxxxxx',
> });
>
> my $users_from_erevan = $users->search({locality => 'Erevan');
>
> Then you will be able to use related data from other tables without doing
> other queries using something like:
>
> while (my $user = $users_from_erevan->next) {
>  print $user->name, "|", $user->email, "\n";
>  print $user->supervisor->name;
>
>  my $clients = $user->clients;
>
>  while (my $client = $clients->next) {
>   print $client->name;
>  }
> }
>
>
> --Octavian
>
> ----- Original Message ----- From: "Steve Harville" <
> steve.harville@xxxxxxxxx>
> To: "Oracle-L Group" <oracle-l@xxxxxxxxxxxxx>
> Sent: Wednesday, September 15, 2010 3:58 PM
> Subject: Anyone using Ruby for scripting?
>
>
>  I'm looking for a common scripting language for system administration
>> and Oracle administration. I have lots of shell scripts that work fine
>> on Linux but I need something that works unchanged on Windows too.  I
>> want to rewrite the shell scripts and the new scripts should be easy
>> to read and comprehend.
>> Any pros,  cons or tips would be appreciated.
>>
>> Steve Harville
>>
>> http://www.linkedin.com/in/steveharville
>> --
>> //www.freelists.org/webpage/oracle-l
>>
>>
>>
> --
> //www.freelists.org/webpage/oracle-l
>
>
>


-- 
______________
Atenciosamente
Waldirio
msn: waldirio@xxxxxxxxx
Skype: waldirio
Site: www.waldirio.com.br
Blog: blog.waldirio.com.br
LinkedIn: http://br.linkedin.com/pub/waldirio-pinheiro/22/b21/646
PGP: www.waldirio.com.br/public.html

Other related posts: