Re: Anyone using Ruby for scripting?

From: Octavian Rasnita <>
Date: Thu, 16 Sep 2010 09:56:35 +0300
Message-ID: <56727D1D9CDF4CFABB46D4F8C8459603_at_octavian>

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=;sid=orcl", "username", "password");

my $sth = $dbh->prepare("insert into users(name, email) values(?, ?)");

$sth->execute('John', ''); $sth->execute('Brian', '');

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=;sid=orcl", "username", "password");

my $users = $schema->resultset("Users");

  name => 'john',
  email => '',

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;


  • Original Message ----- From: "Steve Harville" <> To: "Oracle-L Group" <> 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

> --
Received on Thu Sep 16 2010 - 01:56:35 CDT

Original text of this message