DBI::DB2 install trouble- SQLAllocHandle symbol not found for DB2.so

2001-08-05 Thread Kurogane Akira

Hi,
 I'm having trouble building the DBD::DB2 driver (v0.75), in 
Turbolinux server 6.5, using DB2 V7.1 (Enterprise Edition for Linux, with 
Application Client stuff selected), DBI v1.19, and perl 5.00503.

A quick summary of my problem is this error message during an attempt to 
connect a database handle:-

perl: error in loading shared libraries: 
/usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/DB2/DB2.so: undefined 
symbol: SQLAllocHandle

The installation went fine in the Makefile.PL and make stages, but make 
test gave this feedback:
[root@ns2 DBD-DB2-0.75]# make test
make[1]: Entering directory `/tmp/DBD-DB2-0.75/Constants'
make[1]: Leaving directory `/tmp/DBD-DB2-0.75/Constants'
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib 
-I/usr/lib/perl5/5.00503/i386-linux -I/usr/lib/perl5/5.00503 -e 'use 
Test::Harness qw(runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/base..install_driver(DB2) failed: Can't load 
'blib/arch/auto/DBD/DB2/DB2.so' for module DBD::DB2: 
blib/arch/auto/DBD/DB2/DB2.so: undefined symbol: SQLTables at 
/usr/lib/perl5/5.00503/i386-linux/DynaLoader.pm line 169.

  at (eval 1) line 3
Perhaps a required shared library or dll isn't installed where expected
  at t/base.t line 16
dubious
 Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 4-5
 Failed 2/5 tests, 60.00% okay
t/main..ok
Failed Test  Status Wstat Total Fail  Failed  List of failed
--- 

t/base.t255 65280 52  40.00%  4-5
Failed 1/2 test scripts, 50.00% okay. 2/6 subtests failed, 66.67% okay.
make: *** [test_dynamic] Error 29

When i investigate the DynaLoader.pm file at the error line mentioned, I 
found this potentially enlightening message:
 ...
 # Many dynamic extension loading problems will appear to come from
 # this section of code: XYZ failed at line 123 of DynaLoader.pm.
 # Often these errors are actually occurring in the initialisation
 # C code of the extension XS file. Perl reports the error as being
 # in this perl code simply because this was the last perl code
 # it executed.

 my $libref = dl_load_file($file, $module-dl_load_flags) or
 croak(Can't load '$file' for module $module: .dl_error().\n);
 ...

But, I'm not a c coder so I don't know what to do about this.

If someone knows any special trick I should use (eg. compiling from a 
special directory, being a particular user, etc.) I'd very much appreciate 
the help- I've invested months setting up a new server especially to test 
DB2, and now I can't achieve the one goal I had in mind.

Yours,

Akira




Please Help!! Problem inserting Multi-language CLOBS using UTF8

2001-08-05 Thread Rob Foglia

I have UTF8 text data supporting multiple languages in a text file that I 
need to insert into a CLOB field in an Oracle database (v8.1.7.1.0).  I'm 
using PERL v 5.005_03.  The contents get corruted during the insert process.

Basically, what goes in as:
record name=שלוחולאומבעולם.dcr
item delimiter=,  name=CREATOR

Comes out as:
record name=W)WWWWWWWWWWWWW.dcr
item delimiter=,  name=CREATOR

I've tried this two ways (these are only code excerpts):
1) using a direct embedded perl call using DBI, a la:

my $stmt   = UPDATE lob_table SET detail = :1  .
 WHERE  something = :2 ;
my $sth= $dbh-prepare( $stmt );
$sth-bind_param(1, $buf, {ora_type = ORA_CLOB});
$sth-bind_param(2, 'aValue' );
eval { $sth-execute(); };

2) calling a stored procedure, binding parameters as above.  The stored 
procedure looks a bit like the following:

UPDATE LOB_TABLE
VALUES( id, EMPTY_CLOB() );
DECLARE
  t_clob CLOB;
BEGIN
  SELECT detail INTO t_clob
  FROM   LOB_TABLE
  WHERE  id  = V_id
  FOR UPDATE;
  DBMS_LOB.WRITE( t_clob, V_lob_byte_size, 1, V_detail );
END;


Both methods give the same output when dumped, so I'm inclide to think that 
when DBI or DBD passes the data, it tries convert any UTF8 character 
represented by more than 2 bytes to a 2 byte unicode representation, and 
some data required to represent the character is lost.  Something along 
those lines anyway.
The gist is that we need to be able to tell DBI or Oracle that the data is 
multibyte UTF8 encoded.

Any help is appretiated.

-Rob

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp




Fumbling towards connectivity

2001-08-05 Thread Thomas Good

Hello I am a postgres user now afflicted with Oracle...

I am running Oracle 8.1.6.1.0 on redhat 6.1 using DBD 1.13
and DBD-Oracle 1.07...

my connect str is (dbi:Oracle:, 'doofus', 'hopeless')
but the str seems irrelevant as this is what I get back when I
attempt a connection:

install_driver(Oracle) failed: Can't load 
'/usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/Oracle/Oracle.so' for module 
DBD::Oracle: libclntsh.so.8.0: cannot open shared object file: No such file or 
directory at /usr/lib/perl5/5.00503/i386-linux/DynaLoader.pm line 169.

 at (eval 1) line 3
 at ./chart.pl line 4

Dynaloader seldom (in my experience) gives errors that are even close
to the real issue so I am at a loss.  Can some kind soul lend assistance?

Many thanks!
Tom

   SVCMC - Center for Behavioral Health  

Thomas Good  tomg@ { admin | q8 } .nrnet.org
IS Coordinator / DBA Phone: 718-354-5528 
 Fax:   718-354-5056  

Powered by:  PostgreSQL s l a c k w a r e  FreeBSD:
   RDBMS   |-- linux  The Power To Serve






Re: Program slow even with bind/placeholders....

2001-08-05 Thread Tim Bunce

Nesting
execute
fetch
execute
fetch
execute
fetch
execute
fetch

loops to the degree you have is spectacularly inefficient. As you've
discovered. It's not a DBI issue - it's an application design issue.

Tim.

On Fri, Aug 03, 2001 at 01:36:04PM -0400, Shaozab, Sumera wrote:
 Hello,
 
 I am having some problems with my program running very slow and I hope you
 can help me figure out what  I may be doing wrong:
 
 I am using DBI ver 1.14 and DBD-Oracle ver 1.06.  I am  extracting  some
 data from our database which has around 2.7 million records. The program
 would be running for hours and still never gets completed.  If I start it in
 the morning, it is still running the next day.   Please see a snippet of my
 program below which will explain how I am extracting the data.  As I am
 getting the data, I am putting it in an xml format using XML::writer module.
 Even when I don't do any xml writing, the program is still very slow.  Does
 it normally take a very long time to extract 2.7 million records or my
 program has some faults or maybe oracle needs tuning?  Any help you can give
 is very much appreciated.
 
 Thanks!
 
 Sumera
 
 
 
 As you can see, I am using  bind and place holders and doing the prepares
 outside the loops
 
 
 
 
 
 
 ---
 
 
 
 #!perl 
 
 use DBI;
 connect_database;
 get_ASG;
 
 sub connect_database 
   
   {
   
   $user = user01;
   $password = user_test;
   $dsn = dbi:Oracle:csgd;
   $dbh = DBI -connect($dsn, $user, $password, {RaiseError =
 1} ); 
   }
 
 sub get_ASG
 
   {
   
   
   $sql_ASG = qq{select br_cd, rop_num, flg_num,
 to_char(rcd_dt,'mmdd'), pg_num, addr_nm, adr_line1, adr_line2,
 adr_line3, adr_line4 from tble_main where br_cd = '1' }; 
 
   $sql_pty = q{select past_num, form_num from pty_prop where
 fk_rop_num = ? AND  fk_flg_num = ? };
   $sth_PROP = $dbh-prepare($sql_pty); 
 
   $sql_iss = q{select to_char(iss_date,'mmdd') from
 tble_bil where form_num = ? AND iss_date  sysdate};
   $sth_ISS = $dbh-prepare( $sql_iss); 
   
   $sql_AE = q{Select rcv_nm, str_line1, str_line2, city_nm,
 ste_cd, ps_cd from tble_aesn where fk_rop_num = ? 
 
 
 AND  fk_flg_num = ?};
   $sth_AE = $dbh-prepare($sql_AE);   
 
   $sql_AR = q{Select cnv_nm, to_char(exe_dt,'mmdd'),
 to_char(ack_dt,'mmdd') from tble_ars where 
 
 
 fk_rop_num = ? AND  fk_flg_num = ?};
   $sth_AR = $dbh-prepare( $sql_AR);
   
   eval {
   $sth = $dbh-prepare( $sql_ASG); 
   $sth-execute;  
   $sth-bind_columns(\$br_cd, \$rop_num, \$flg_num, \$rcd_dt,
 \$pg_num, \$addr_nm, \$adr_line1, \$adr_line2, 
 
 
 \$adr_line3, \$adr_line4 );
 
   while ($sth-fetch) {
   
   check_pty; 
   # do xml stuff here.
   }
 
   } # close while loop
   }; # close eval loop
   
   END { $^W = 0; }
   $sth-finish;
   $dbh-disconnect;
   }
 
 
 sub check_pty  {
 
   $sth_PROP-execute($rop_num, $flg_num); 
   $sth_PROP-bind_columns(\$past_num,\$form_num);
   
   while ($sth_PROP-fetch){
   if ($fk_rop ne   $past_num ne ){
   check_iss;
   }
   
 }
   }
 
 
 sub check_iss  {
   $sth_ISS-execute($form_num); 
   $sth_ISS-bind_columns(\$iss_date);
   while ($sth_ISS-fetch){
   get_asgee; 
   get_asgr;  
   # do xml stuf here
   }
}
 
 
 sub get_assgee
 
   {
   
   $sth_AE-execute($rop_num,$flg_num); 
   $sth_AE-bind_columns(\$rcv_nm, \$str_line1, \$str_line2,
 \$city_nm, \$ste_cd, \$ps_cd);
   
   while ($sth_AE-fetch){
   
   # do xml stuff here
   }
 
 sub get_asgr
 
   {
   
   $sth_AR-execute($rop_num,$flg_num); 

RE: Perl.exe generating errors when used on Win 2K

2001-08-05 Thread Neil Lunn


Yes. While the soolution below is correct it might help to tell the person
who oringally posted this question why they where getting an error.

The difference is in:

$sth = $dbh-do(insert 
$sth-bind_param( ...

and

$sth = $dbh-prepare(insert
$sth-bind_param( ...

Essentially the previous code is trying to bind an input paramter to a
statement that is already executing and therefore is an error.

The RaiseError attribute should be set when in doubt about where and error
is coming from and you can always use DBI-trace.

--Neil


$insert_sql = EOT
Insert into ofas
(company,time,region,lineitem,actual,actualus)
values (?,?,?,?,?,?)
EOT

$sth = $dbh-prepare($insert_sql) || die $dbh-errstr;

while ($line = tmptestper) {

   # your unpack and other stuff here


   $sth-bind_param(1,$company);
   $sth-bind_param(2,$year);
   $sth-bind_param(3,$region);
   $sth-bind_param(4,$lineitem);
   $sth-bind_param(5,$actual);
   $sth-bind_param(6,$actualus);
   $sth-execute || die $sth-errstr;

   $dbh-commit;  # autocommit on?
}


- Original Message - 
From: Anurag Minocha [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, August 03, 2001 9:48 AM
Subject: Perl.exe generating errors when used on Win 2K


 
 Hi,
 I have Perl installed on my windows 2000 machine but when I 
execute a perl
 dbi script windows gives me a program error.
 
 Here is the error
 Perl.exe has generated errors and will be closed by windows. 
You will need
 to restart the program. An error log is being created.
 
 Here is the script I am trying to execute
 
 #! c:\perl\bin 
 use dbi;
 
 my $dbh =
 DBI-connect(dbi:Oracle:local_orcl8i,localcompany,localcompany)
 or die Can't Connect to Oracle Database $DBI::errstr\n;
 
 
 open (tmptestperl , testperl.txt) or die Cant Open 
testperl.txt \n;
 
 while ($line = tmptestperl) {
 ($company,$year,$region,$lineitem,$actual,$actualus) =
 unpack(A10 X A10 X A10 X A15 X A20 X A*, $line);
 
 $actual =~ s/,//g;
 $actual =~ s/NA//;
 
 $actualus =~ s/,//g;
 $actualus =~ s/NA//;
 
 $sth = 
 $dbh-do( Insert into ofas
 (company,time,region,lineitem,actual,actualus)
 values (?,?,?,?,?,?));
 
 $sth-bind_param(1,$company);
 $sth-bind_param(1,$year);
 $sth-bind_param(1,$region);
 $sth-bind_param(1,$lineitem);
 $sth-bind_param(1,$actual);
 $sth-bind_param(1,$actualus);
 
 
 print $actual \n;
 
 
 
 }
 
 This script was working fine insert and bind variable 
statements. i.e when I
 wasnt trying to insert into the database.
 
 Please Suggest something
 
 Thanks
 Anurag
 


__
Please Note :
Only  the intended recipient is authorised to access or use this e-mail.
If you are not the intended recipient, please delete this e-mail and notify
the sender immediately. The contents of this e-mail are the writer's 
opinion and are not necessarily endorsed by the Gunz Companies
unless expressly stated.

We use virus scanning software but exclude all liability for viruses or
similar in any attachment.