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

Hello Monks,

On this one, I've searched CPAN for the DBI mod text, google, and here and I am really stuck in the weeds.

I just want to be able to validate using the Perl DBI mod in one of my work environments. As to experience, I have used it for basic things on my linux box with a mysql database - that's it.

Anyway, here's the code and then the error and I just don't know how to investigate this. I changed some values that are work-related like the database name or the actual table name in the query statement.

#!/usr/bin/perl use DBI; use strict; my ( $drh, $dbh, $sth ); $drh = DBI->install_driver( 'oracle' ); $dbh = DBI->connect('DBI:oracle:DBNAME', 'userName', 'userPswd'); die "Cannot connect: $D: $DBI::errstr\n" unless $dbh; $sth = $dbh->prepare("describe table_name;"); $sth->execute; $dbh->disconnect; exit;


And here is the error:

ld.so.1: perl: fatal: relocation error: file /blah/blah/blah/lib/auto/ +DBI/DBI.so: symbol Perl_get_sv: referenced symbol not found Killed
Sure would appreciate some help, even if just some pointers on HOW to troubleshoot this.

Thanks in advance,

Tony

Replies are listed 'Best First'.
Re: Perl DBI-Related Error - really in the weeds
by runrig (Abbot) on Feb 23, 2006 at 00:49 UTC

    Just some comments and questions.

    • You don't need the "install_driver" statement.
    • I believe it should be "Oracle" not "oracle" in the connect statement (see the DBD::Oracle docs).
    • "describe" is probably not a SQL statement (not everything that works in SQL*Plus works in OCI or DBD::Oracle).
    • How did you install DBI (and DBD::Oracle)?
      Oh boy...

      Your questions are certainly demonstrating my ignorance.

      I tried to mimic code that I took from part of a perl script I wrote for mysql.

      I did not install DBI and don't know if DBD::Oracle is installed nor have I ever heard of it, nor did I even know it was required in order for my script to run.

      I am at work and will be away for a bit, but THANKS. You have certainly shed some light into my darkness.

      Tony
      By the way, describe does work. I tried it before using it.
        It worked in mysql or Oracle? (and how do you know it worked if you can't get it working?)

        Update: And some quick googling tells me that DESCRIBE is a SQL*Plus command, but not valid SQL. You can maybe use the DBI table_info method (or column_info? I don't know, I've never used either one) or select from one of the Oracle *_TABLES (*=DBA|ALL|USER) tables.

        For the record, I just tested a describe statement using working copies of DBI and Oracle. The statement fails on execute with this error:
        DBD::Oracle::st execute failed: ORA-00900: invalid SQL statement (DBD +ERROR: OCIStmtExecute) [for Statement "describe [schema.table removed + for security]"]
Re: Perl DBI-Related Error - really in the weeds
by kwaping (Priest) on Feb 23, 2006 at 00:47 UTC
      Thanks,

      I'll give that a shot tomorrow some time. I am pretty beat right now.

      Tony
Re: Perl DBI-Related Error - really in the weeds
by PodMaster (Abbot) on Feb 23, 2006 at 09:25 UTC
    You're mixing incompatible perls (you're using one perl, but DBI was compiled with another, and @INC contains paths pointing to it).

    Don't do that.

    Super Searching for {fatal relocation error} or {referenced symbol not found} should have yielded ld.so.1: perl: fatal: relocation error (I'm sure googling would've also resulted in relevant hits).

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

      Hi PodMaster,

      Sorry this took so long to reply to. I got severely pulled away.

      Yes, it was as you said and was my troubleshooting idiotic. Because in google, I did see version complaints with the same error - just not specifically for a Perl DB mod usage.

      But, I thank you sir, I fixed that problem, and am on to new ones! (Like i said, got pulled away and now it appears my syntax for a Oracle dbm is wrong.)

      Tony