Yes, I am aware of that, but you still need a username and password.  In
SQL*Plus which is an Oracle specific application you can connect using "/ as
sysdba"  which uses the operating system to verify if you belong to the dba
group.  Using DBD you cannot use the "/ as sysdba" to connect.  You can use
the ora_session_modes but you still need to pass a username and password.
If you look at your code you are connecting as "SYS as SYSDBA" not "/ as
sysdba".  

-----Original Message-----
From: Alan Burlison [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 9:17 AM
To: Gold, Samuel (Contractor)
Cc: 'Christian Merz'; [EMAIL PROTECTED]
Subject: Re: Oracle connect internal/OS authentification


Gold, Samuel (Contractor) wrote:

> Sorry, but there is no way.  / as sysdba is a SQL*Plus specific command. I
> opened a tar with oracle on the issue of being able to connect / as sysdba
> and using OCI to shutdown the database like the shutdown command in
> SQL*Plus.  They told me that neither could be done.  I created a user with
> very specific privileges and set very restrictive permissions on my script
> that contains that information.  I also created packages to do specific
> things and granted execute on those packages to that user.  That is the
best
> solution that I have been able to come up with.  I hope that helps.

        use DBD::Oracle qw(:ora_session_modes);

         # Connect and initialise.
         my %attr = ( AutoCommit => 0, PrintError => 0 };
         if ($username =~ /^SYS\s+AS\s+(SYS(?:DBA|OPER))$/i) {
                 $username = 'SYS';
                 if ($1 =~ /^SYSDBA$/i) {
                         $attr{ora_session_mode} = ORA_SYSDBA;
                 } else {
                         $attr{ora_session_mode} = ORA_SYSOPER;
                 }
         }
         if (! ($Db = DBI->connect("dbi:Oracle:$database",
             $username, $password, \%attr))) {
                 error("Can't login to Oracle:", $DBI::errstr);
                 return(0);

-- 
Alan Burlison
--



Reply via email to