You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Ruben Safir <ru...@mrbrklyn.com> on 2014/11/23 06:42:51 UTC
Re: Perl + DBD-Oracle, problems with encoding when "PerlHandler
Apache::Registry" is in use
did you ever get this worked out.
I'm looking to use perl with my oracle set up. Any tips would be
appreciated.
Ruben
On Fri, Feb 19, 2010 at 05:47:51PM +0700, michael kapelko wrote:
> Hello.
> Here's a short script I used to find out the problem with the Apache::Registry:
>
> #!/usr/bin/perl -wT
> use strict;
> use warnings;
> use CGI;
> use DBI;
> use DBI qw(:sql_types);
> use encoding 'utf-8';
>
> my $cgi = new CGI;
> print $cgi->header(-type => "text/html",
> -charset => "utf-8");
> print $cgi->start_html(-lang => "ru-RU",
> -title => "Title");
> print $cgi->h1("Title");
> my $db = DBI->connect("DBI:Oracle:SID=ELTC;HOST=10.102.101.4",
> <username>, <userpassword>, {RaiseError => 1,
> AutoCommit => 0,
> ora_charset => "UTF8"});
> my $query = "select name from swmgr2.vw_switches where sw_id_ip =
> 2315046666"; // Selects Russian "name" from DB in UTF-8, because on
> the previouse line we asked Oracle to return data to us in UTF-8.
> my $stmt = $db->prepare($query);
> $stmt->execute();
> my $name;
> $stmt->bind_columns(undef, \$name);
> $stmt->fetch();
> $stmt->finish();
> $db->disconnect();
> print $cgi->p($name);
> print $cgi->end_html();
>
> When invoked directly by the shell or in web page WITHOUT "PerlHandler
> Apache::Registry", the UTF-8 encoded string in Russian is printed just
> fine. But when "PerlHandler Apache::Registry" is used, only ???? are
> printed in web page.
> Thanks.
>
> .
--
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com
Being so tracked is for FARM ANIMALS and and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013
Re: Perl + DBD-Oracle, problems with encoding when "PerlHandler Apache::Registry"
is in use
Posted by Dr James Smith <js...@sanger.ac.uk>.
On 23/11/2014 05:42, Ruben Safir wrote:
> did you ever get this worked out.
>
> I'm looking to use perl with my oracle set up. Any tips would be
> appreciated.
I had similar problems Apache 2.2 with DBD::Oracle, after serious
debugging there
was a nasty environment variable issue - DBD::Oracle when first 'use'd
was not
finding the appropriate oracle environment variables, and consequently
wasn't
pulling in oracle defaults (and reading things like tnanames file) and
then caching
the broken values - subsequent 'use's were failing because it wasn't
reading the
oracle config from disk - but using it's own cached values from the
first "use"..
James
> Ruben
>
>
> On Fri, Feb 19, 2010 at 05:47:51PM +0700, michael kapelko wrote:
>> Hello.
>> Here's a short script I used to find out the problem with the Apache::Registry:
>>
>> #!/usr/bin/perl -wT
>> use strict;
>> use warnings;
>> use CGI;
>> use DBI;
>> use DBI qw(:sql_types);
>> use encoding 'utf-8';
>>
>> my $cgi = new CGI;
>> print $cgi->header(-type => "text/html",
>> -charset => "utf-8");
>> print $cgi->start_html(-lang => "ru-RU",
>> -title => "Title");
>> print $cgi->h1("Title");
>> my $db = DBI->connect("DBI:Oracle:SID=ELTC;HOST=10.102.101.4",
>> <username>, <userpassword>, {RaiseError => 1,
>> AutoCommit => 0,
>> ora_charset => "UTF8"});
>> my $query = "select name from swmgr2.vw_switches where sw_id_ip =
>> 2315046666"; // Selects Russian "name" from DB in UTF-8, because on
>> the previouse line we asked Oracle to return data to us in UTF-8.
>> my $stmt = $db->prepare($query);
>> $stmt->execute();
>> my $name;
>> $stmt->bind_columns(undef, \$name);
>> $stmt->fetch();
>> $stmt->finish();
>> $db->disconnect();
>> print $cgi->p($name);
>> print $cgi->end_html();
>>
>> When invoked directly by the shell or in web page WITHOUT "PerlHandler
>> Apache::Registry", the UTF-8 encoded string in Russian is printed just
>> fine. But when "PerlHandler Apache::Registry" is used, only ???? are
>> printed in web page.
>> Thanks.
>>
>> .
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
--
The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.