Advertisement

01.23.2007 at 08:32AM PST, ID: 22133250
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Oracle DBD charset error when searching using text

Asked by g_tunley in Perl Programming Language

Tags: , ,

Hi,

I'm trying to write a function which will search a table within Oracle for various columns when certain parameters are met. It works just fine when I use numeric search criteria but as soon as I try and search for rows where a particular column matches a text string I get the following:

me@myserver ~ $ ./poller3.pl
Searching for feeds with providerid=108 and feedcode=crystal palace
SMSAlerts::Feeds can't SELECT feedid, feedcode, serviceid
FROM   feeds
WHERE  enabled = ? AND feedcode = ? AND providerid = ?
: DBD::Oracle::st execute failed: ORA-12704: character set mismatch (DBD ERROR: error possibly near <*> indicator at char 88 in 'SELECT feedid, feedcode, serviceid
FROM   feeds
WHERE  enabled = :p1 AND feedcode = :p2 <*>AND providerid = :p3
') [for Statement "SELECT feedid, feedcode, serviceid
FROM   feeds
WHERE  enabled = ? AND feedcode = ? AND providerid = ?
" with ParamValues: :p3='108', :p1=1, :p2="crystal palace"] at /usr/me/environment/perl-5.8.7/lib/site_perl/5.8.7/DBIx/ContextualFetch.pm line 52.
 at /usr/me/environment/perl-5.8.7/lib/site_perl/5.8.7/Class/DBI/Search/Basic.pm line 169
me@myserver ~ $

In my environment I have the following variables set:

NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS'
NLS_LANG=american_america.we8iso8859p1

which matches how the database itself is configured.

This is the code which generates the above error:

print "Searching for feeds with providerid=$providerid and feedcode=$message->{feedCode}\n";
$feeds = $feedsclass->search(enabled => 1, providerid => $providerid, feedcode => $message->{feedCode});
print "Feeds=" . Dumper($feeds);

and for reference here is how I am connecting to the database:

#!/usr/me/environment/perl/bin/perl -w

use Class::DBI::Loader;
use Class::DBI::AbstractSearch;
use Data::Dumper;
use Digest::MD5;
use Log::Log4perl;
use LWP::UserAgent;
use POSIX qw(strftime);
use XML::Simple;

# Connect to Database and Initialise Tables

my $database = Class::DBI::Loader->new(
        dsn => 'dbi:Oracle:SID=mysid;host=1.2.3.4;port=1521;',
        user => 'myuser',
        password => 'mypassword',
        options => { LongTruncOk => 1, LongReadLen => 524288 },
        namespace => 'mynamespace',
        additional_classes => 'Class::DBI::AbstractSearch',
        relationships => '0');

unless ($database) {
        print "Error\n";
        exit;
}

my $providerclass = $database->find_class('providers');
$providerclass->columns(Primary => 'Providerid');
$providerclass->columns(Essential => qw/ providerid url frequency timeout lastid /);

my $feedsclass = $database->find_class('feeds');
$feedsclass->columns(Primary => 'Feedid');
$feedsclass->columns(Essential => qw/ feedid feedcode serviceid /);

(and yes I know that I need better error handling, I'm just debugging at the moment though).

Has anyone got any ideas where I'm going wrong and what I need to do to fix it?

Thanks

G
Start Free Trial
[+][-]01.23.2007 at 04:10PM PST, ID: 18381134

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.24.2007 at 12:02AM PST, ID: 18383777

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.24.2007 at 01:38AM PST, ID: 18384049

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.30.2007 at 06:35AM PDT, ID: 20176967

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]11.04.2007 at 05:46AM PST, ID: 20210463

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: oracle, charset, perl
Sign Up Now!
Solution Provided By: Computer101
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-44