On Sat, 17 Jun 2006 10:20:14 -0700 (PDT), Hugh Shedd wrote:
Hi Hugh
> I installed Oracle's free Express 10g on my XP home box to learn
See /very/ recent messages to this list for some of my experiences.
> Now I want to hookup perl and motor the database from scripts.
1) Create Oracle user: xyz/seekrit
2) Create a system DSN, specifying (a) a name, e.g. oracle-xyz (b) a TNS Service
Name of 'XE'. No other options need be set
3) Run this, just like you would for any database (yes, the she-bang line is
correct, it's for Apache under Windows [1]):
-----><8-----
#!/usr/bin/perl
#
# Name:
# test-oracle.pl.
use strict;
use warnings;
use DBI;
# ---------------------
print 'Before connect: ', scalar localtime(), ". \n";
my($dbh_1) = DBI -> connect('dbi:ODBC:oracle-user', 'xyz', 'seekrit',
{RaiseError => 1, PrintError => 0});
print 'After connect: ', scalar localtime(), ". \n"; # Expect 16 seconds delay.
eval{$dbh_1 -> do('drop table t')};
eval{$dbh_1 -> do('create table t(i integer)')};
my($sth_1);
$sth_1 = $dbh_1 -> prepare('insert into t(i) values (?)');
$sth_1 -> execute($_) for (1 .. 5);
$sth_1 -> finish();
$sth_1 = $dbh_1 -> prepare('select * from t');
$sth_1 -> execute();
my($data);
while ($data = $sth_1 ->fetch() )
{
print "$$data[0]. \n";
}
-----><8-----
[1] http://savage.net.au/Perl/html/upgrade-perl-apache.html
--
Cheers
Ron Savage, [EMAIL PROTECTED] on 18/06/2006
http://savage.net.au/index.html
Let the record show: Microsoft is not an Australian company