2007fld has asked for the wisdom of the Perl Monks concerning the following question:

I have a perl script below which connects/writes to Oracle 9. It works very well.
But I want to use encrypted link (or Oracle Advanced Secuiry) to make the connection/write more secure.
What changes do I need to make in my Perl script and Oracle settings?
Thanks!

#!/perl/bin/perl
........
use DBI;
my $dbh = DBI->connect
( 'dbi:Oracle:host=xx.xx.xx.xxx;sid=xxx',
'name',
'password',
)
.....
my $info = "insert into table1 values('$user','$filename','$filesize','$time','$direction')";
my $sth = $dbh->prepare($info);
$sth->execute();
$dbh->commit();
.....

  • Comment on Perl connects/writes to Oracle using Oracle encrypted link

Replies are listed 'Best First'.
Re: Perl connects/writes to Oracle using Oracle encrypted link
by dHarry (Abbot) on Aug 22, 2008 at 15:13 UTC

    (I haven't touched Oracle for some time so with the risk of BS-ing) It's a choice when you install the Oracle client. "Under water" the Oracle client is used for db communication. So if you change the settings to "encrypted connections" then your Perl connection will also be encrypted. The user/password are always encrypted (by default). After making the connection encrypted everything is encrypted

    You can enable "client side tracing" (edit sqlnet.ora for this) to test if it is really working.

    Hope this helps

    Update

    Stop the press, with ODBC it's a different story! What kind (brand) of ODBC driver do you use?

    Update 2

    Brother massa is right of course. See How do I encrypt network traffic to an Oracle instance? for additional information.

    (The last time I played with this it was a JDBC connection to an Oracle 8 db which took some effort...)

      OP did not indicate to be using ODBC. Au contraire, 'dbi:Oracle:' indicates the use of Oraperl (native Oracle bindings).
      Just one comment to the OP: don't do
      my $info = "insert into table1 values('$user','$filename','$filesize', +'$time','$direction')"; my $sth = $dbh->prepare($info); $sth->execute();
      -- use instead either
      my $info = "insert into table1 values (?, ?, ?, ?, ?)"; my $sth = $dbh->prepare($info); $sth->execute($user, $filename, $filesize, $time, $direction);
      or
      my $info = "insert into table1 values(:user,:filename,:filesize,:time, +:direction)"; my $sth = $dbh->prepare($info); $sth->bind_param(user => $user); $sth->bind_param(filename => $filename); $sth->bind_param(filesize => $filesize); $sth->bind_param(time => $time); $sth->bind_param(direction => $direction); $sth->execute();
      (for various reasons, including security ones)
      []s, HTH, Massa (κς,πμ,πλ)
Re: Perl connects/writes to Oracle using Oracle encrypted link
by massa (Hermit) on Aug 22, 2008 at 16:24 UTC
    More Oracle info here. Didn't find how to enable SSL in the whitepaper, though. But it's a start for you.
    Update: apparently, you have to be the DBA to enable SSL in the session, and it's done through the "Oracle Net Manager". More info in the "Oracle Database Advanced Security Administrator's Guide" (*), in your copy of the Oracle docs. Hope this helps you get started.
    (*) c. page 64 (2-2) in the "10g" version of the manual, YMMV...
    []s, HTH, Massa (κς,πμ,πλ)