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

I'm fully aware that DBI allows one to execute Oracle PL/SQL stored procedures via a simple prepare(..) statement (as in the example below..):
# ... my $dbh = DBI->connect('dbi:Oracle:host', 'user', 'pass') || die $DBI::errstr; eval { my $db_proc = $dbh->prepare(qq| BEGIN my_procedure(:foo); END; |); $db_proc->bind_param(':foo', 'bar'); $db_proc->execute; $db_proc->finish; $dbh->commit; }; if ($@) { $dbh->rollback; } # ...

However, exactly same code that I'd used to execute PL/SQL stored procedures wouldn't work for Java stored procedures.

Would any monk out there have any idea how I could make this work?

Your help is much appreciated ;-)

"There is no system but GNU, and Linux is one of its kernels." -- Confession of Faith

Replies are listed 'Best First'.
Re: executing Java Oracle stored procedures...
by rdfield (Priest) on Feb 06, 2002 at 10:05 UTC
    Have you given the procedure owner enough privs to execute the statement? Capture the ORA number ($dbh->err, or $dbh->errstr) and check Oracle Metalinks. My guess is you need to execute the following before it'll be close to working:
    call dbms_java.grant_permission('<schema>','java.net.SocketPermission' +,'<hostname>','resolve'); call dbms_java.grant_permission('<schema>','java.net.SocketPermission' +,'<ipaddress>:<listener port, usually 1521>','resolve,connect'); call dbms_java.grant_permission('<schema>','java.util.PropertyPermissi +on','*','read,write'); commit;

    rdfield

Re: executing Java Oracle stored procedures...
by axelrose (Scribe) on Feb 06, 2002 at 09:48 UTC
    just a wild guess:
    have you tried $dbh->do( "BEGIN my_myproc(:foo); END;", 'bar' )
    is the pipe | at the end of the procedure on purpose?