Re: Perl DBI Oracle SYSDBA help/advise please:
[email protected] (Jared Still)
| Newsgroups | perl.dbi.users |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Feb 10, 2010 at 4:21 PM, newbie01 perl <[email protected]>wrote: > Hi all, > > To anyone who had been using Perl DBI and Oracle, can you please confirm if > connection by SYSDBA works or doesn't? > > Works for me RH Linux EL 4 Oracle 10.2.0.4 Perl v5.8.8 DBD::Oracle 1.23 ======== use DBI; use DBD::Oracle qw(:ora_session_modes); print $DBI::VERSION,"\n"; # this prints the DBI version $dsn = "dbi:Oracle:"; # no dbname here $ENV{ORACLE_SID} = "mydb"; # set ORACLE_SID as needed delete $ENV{TWO_TASK}; # make sure TWO_TASK isn't set $dbh = DBI->connect($dsn, "", "", { ora_session_mode => ORA_SYSDBA }); # no need to supply username and password my $sth = $dbh->prepare("alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS'"); $sth->execute(); $sth = $dbh->prepare("select 'Today is ' || sysdate from dual union all select user from dual"); $sth->execute(); while (my ($sysdate) = $sth->fetchrow_array()) { print $sysdate, "\n"; } $sth->finish(); 1.609 Today is 11-FEB-2010 16:31:48 SYS ===== Jared Still Certifiable Oracle DBA and Part Time Perl Evangelist Oracle Blog: http://jkstill.blogspot.com Home Page: http://jaredstill.com