SPUG: Not a CODE reference

Brittingham, John john.brittingham at attws.com
Wed Sep 12 14:55:29 CDT 2001


I keep getting an error stating that Not a CODE reference at
extract_ccml__to_oracle_db_testing.pl line 384.
Anyone have any suggestions?

379 $title ="$subproc_heading[$n]";
380 $dscr ="$subproc_xml_var2[$n]";
381 $dbh->{LongReadLen} = 2**20;   # 1 MB max message size 
382 $dbh->{LongTruncOk} = 0;   
383 $sth = $dbh->prepare(qq{INSERT INTO t_opr_instr (
TITLE,DSCR,ORDER_SEQ,PRD_MODEL_SPEC_ITEM_ID ) VALUES (?, ?, ?, ?) });
384 $sth->( 1, $title);
385 $sth->( 2, $dscr, {ora_type => ORA_CLOB} );
386 $sth->( 3, $ord_seq);
387 $sth->( 4, $prd_model_spec_item_id);
388 $sth->execute ; 

-----Original Message-----
From: Brittingham, John [mailto:john.brittingham at attws.com]
Sent: Wednesday, September 12, 2001 12:21 PM
To: dbi-users at perl.org; spug-list at pm.org
Subject: insert Clob problems


I get the following error when I try to insert a CLOB using DBI: Not a CODE
reference at extract_ccml__to_oracle_db_testing.pl line 381, <FILE_NAMES>
line 1. What am I doing wrong?

380 $sth = $dbh->prepare(qq{INSERT INTO t_opr_instr (
TITLE,DSCR,ORDER_SEQ,PRD_MODEL_SPEC_ITEM_ID ) VALUES (?, ?, ?, ?) });
381 $sth->( 1, $subproc_heading[$n]);
382 $sth->( 2, $dscr, SQL_LONGVARCHAR);
383 $sth->( 3, $ord_seq);
384 $sth->( 4, $prd_model_spec_item_id);
385 $sth->execute ; 

-----Original Message-----
From: Ruchi Varma [mailto:ruchi at synopsys.COM]
Sent: Wednesday, September 12, 2001 11:08 AM
To: dbi-users at perl.org
Subject: dynamic loading...


hello,

  I had previously sent a message, regarding dynamic loading, on this
newsgroup since i had problems installing   DBD on my Solaris Box. I hence
used the perl executable, created by the DBI installation in the dir
/remote/tools/ruchi/perl5/site_perl/5.005/DBI-1.20/, to install DBD and it
worked. But now when i run my cgi script using the DBI and DBD i have
installed, it gives me the same error concerning Dynamic Loading. I have
attached my script to this message ..Please look at it and give me some
comments on how to solve this problem.

----------------------------------------------------------------------------
----------------------------
#!/remote/tools/ruchi/perl5/site_perl/5.005/DBI-1.20/perl -- -*-perl-*-
 # I also tried using /usr/local/bin/perl5.6   ..but no luck...

use lib qw(/remote/tools/ruchi/perl5
           /remote/tools/mysql
           /remote/tools/ruchi/perl5/site_perl);
use DBI;
use CGI;
use CGI::Carp qw(fatalsToBrowser);

$driver = "mysql";
$dsn = "DBI:$driver:database = ASSETLOCATOR";
$dbUserName = "root";
$dbPassword = "blah";

$dataIn       = new CGI;
$dataIn->header();
$requestType  = $dataIn->param('requestType');
$sql  = $dataIn->param('sql');

if ($sql eq "")
        {
        &printSearchForm();
        exit;
        }
else
        {
        $dbh = &connectToDB();
        $dataObject = executeSQLStatement($sql);
        @dbRows = &getDBRows($dataObject);
        if ($sql =~ /^SELECT/i)
                {
                print qq!
                <HTML>
                <HEAD>
                <TITLE>SQL Statement results</TITLE>
                </HEAD>
                <BODY BGCOLOR = "FFFFFF" TEXT = "000000">
                <CENTER>
                <TABLE BORDER = "1">!;
                foreach $rowReference (@dbRows)
                        {
                        foreach $columnReference (@$rowReference)
                                {
                                print qq!<TR>!;
                                foreach $column (@$columnReference)
                                        {
                                        print qq!<TD>$column</TD>\n!;
                                     }
                                print qq!</TR>!;
                                }
                        }
                print qq!
                </TABLE>
                </CENTER>
                </BODY>
                </HTML>!;
                exit;
                }
        else
               {
                  print "Your SQL Query has been processed, please hit the
back
button and submit a SELECT to see the changes!";
                }
        }

sub connectToDB
        {
        return (DBI->connect($dsn, $dbUserName, $dbPassword));
        }
sub executeSQLStatement
        {
        my ($sql) = shift;
        $dataObject = $dbh->prepare($sql);
        $dataObject->execute();
        return $dataObject;
        }

sub getDBRows
        {
        my ($dataObject) = shift;
        return $dataObject->fetchall_arrayref();
        }

sub printSearchForm
        {
        print qq!
        <HTML>
        <HEAD>
        <TITLE>Enter SQL</TITLE>
 </HEAD>
        <BODY BGCOLOR = "FFFFFF" TEXT = "000000">
        <FORM METHOD = "POST" ACTION = "query.cgi">
        <TABLE BORDER = "1">
        <TR>
        <TH>Enter SQL Query</TH>
        <TD><INPUT TYPE = "TEXT" SIZE = "40" NAME = "sql"></TD>
        <TD><INPUT TYPE = "SUBMIT" NAME = "requestType" VALUE = "Submit
SQL"></T
D>
        </TR>
        </TABLE>
        </FORM>
        </BGODY>
        </HTML>!;
        }
----------------------------------------------------------------------------
---------------------
the dir /remote/tools/mysql has mysql installed
the dir /remote/tools/ruchi/perl5/site_perl/5.005 has both DBD and DBI
installed 

The error i get is 
Can't load module DBI, dynamic loading not available in this perl.
  (You may need to build a new perl executable which either supports
  dynamic loading or has the DBI module statically linked into it.)
 at /remote/tools/ruchi/perl5/site_perl/DBI.pm line 189
BEGIN failed--compilation aborted at
/remote/tools/ruchi/perl5/site_perl/DBI.pm line 189.
Compilation failed in require at query.cgi line 6.
BEGIN failed--compilation aborted at query.cgi line 6.

Since the problem appears due to the perl version i am using, which perl
version should i use? As far as i know perl versions from 5.004 onwards
support dynamic loading. But i am using version 5.6...and it still does not
seem to work..:(

kindly help..
thanks
Ruchi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/archives/spug-list/attachments/20010912/3cf80915/attachment.htm


More information about the spug-list mailing list