bigpresh / Dancer-Plugin-Database

Dancer::Plugin::Database - easy database support for Dancer applications
http://search.cpan.org/dist/Dancer-Plugin-Database
37 stars 36 forks source link

Oracle NLS parameters #53

Open K-C-E opened 10 years ago

K-C-E commented 10 years ago

Need some help. I have an Oracle database, and to retrieve the data I need to set an environment variable NLS_LANG. Usually I do it like this: $ENV{NLS_LANG} ="AMERICAN_AMERICA.CL8MSWIN1251"; If I run the Dancer2 application with Dancer-Plugin-Database in standalone mode - it works. When I run it through plackup or Starman I get the data in a wrong encoding . Where should I register NLS_LANG and possibly other language variables for Oracle?

Thank you.

bigpresh commented 9 years ago

Sorry for the hugely late reply to this. I'm afraid I have no idea about Oracle, so I don't know what help I can offer here - but I'd think that setting NLS_LANG before executing the app should work, whichever way you execute it.

However, the docs for DBD::Oracle suggest:

For oracle versions >= 9.2 you can specify the client charset and ncharset with the ora_charset and ora_ncharset attributes. You still need to pass ora_envhp = 0 for all but the first connect.

... with the example:

$dbh = DBI->connect ($dsn, $user, $passwd, {ora_charset => 'AL32UTF8'});

So, if you still have this problem (or if not, for the benefit of anyone else who does and finds this issue) I'd recommend putting ora_charset in the dbi_params section of the D::P::D configuration and see if that works for you?