Re: Oraperl problem

From: Jacqui Caren <Jacqui.Caren_at_ig.co.uk>
Date: 1998/01/21
Message-ID: <En4uqH.2uy_at_ig.co.uk>#1/1


[ posted and emailed ]

In article <34B536CE.1C25CD8E_at_lanl.gov>, Donner Holten <donner_at_lanl.gov> wrote:
> I'm having problems with an oracle script. I can't seem to log onto
>oracle because the program can't find something called orlon. Any help
>would be appreciated. Thanks.

This is probably due to your version of perl4 oraperl using v6 OCI. This is antique and unsupported (oracle and perl) software. Given that a full oraperl emulation interface for perl5 has been available for years and no bugfixes have been made to perl4 or oraperl for perl4 during this time you want to seriously think about moving to perl5 and Oraperl.

>-------------------------------------
>#! /opt/oracle/src/oraperl-v2.4/oraperl -w

See http://www.hermetica.com/technologia/DBI/ for information about DBI

By adding the

        use Oraperl;

line (and some minor typographical changes) your software is migrated!

>
># Specify Username
>
># $database='T:128.165.128.115/1525:pcsr';

This is sqlnet V1 - which is no longer supported. What version of oracle are you running on? If this is a commercial application you should start to think about a sql*Net V1 -> V2 migration plan...

>$lda=&ora_login($database, $user_name, $passwd) || die;

use the $ora_errstr and $ora_errno variables that Oraperl emulation interface provides for you.

># Open a cursor and execute the querry.
>
>$csr=&ora_open($lda, "select initcap(name), grp, email from phone_file
>where znu
>m = '121870'") || die;

change this to

my $csr = ora_open($lda, "select...");
die "$ora_errstr" if $ora_errno;

>_at_results=&ora_fetch($csr);

my (_at_results) = ora_fetch($csr);

you do not need the & for sub calls in perl5

remember to check $ora_errno and die $ora_errstr if it is set.

># Close a cursor and
># Disconnect the database server
>
>&ora_close($csr);
>&ora_logoff($lda);

DBI is OO, which means that when a $csr or $lda goes out of scope it gets closed automatically. This was one really big problem with oraperl.

This means if you write a sub or code block that has the $lda or $csr in scope and you do not pass references to it out of scope then the $lda or $csr is closed.

i.e.

a function to create $csr and get first record then close $csr.

sub do_sql { my ($lda,$sql) = shift;

	my $csr = ora_open($lda,$sql);
	die "open: $sql gives $ora_errstr" if $ora_errno;
	my (_at_rec) = ora_fetch($csr);
	die "fetch: $sql gives $ora_errstr" if $ora_errno;
	return \_at_rec;

}

to use it

my $rec = do_sql("select table_name from user_tables"); print join(", ", _at_$rec),"\n";

>/usr/lib/dld.sl: Unresolved symbol: orlon (code) from ./testprog1

It sounds like you are missing pro*C (OCI libs) on this machine or have an incomplete LD_LIBRARY_PATH etc. Or you have upgraded oracle without rebuilding your oraperl.

Also have a look at the DBI interface itself. It provides a database independant API for accessing RDBMS and DBMS. It also provides greater flexibility than the Oraperl emulation interface.

Jacqui

-- 
Jacqui Caren                    Email: Jacqui.Caren_at_ig.co.uk
Paul Ingram Group               Fax: +44 1483 419 419
140A High Street                Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom
Received on Wed Jan 21 1998 - 00:00:00 CET

Original text of this message