bigpresh/Dancer-Plugin-Database

DBI::Oracle is not supported correctly

slatibart opened this issue · 6 comments

For example you can not set the sid string for the dbi connection.

$dbh = DBI->connect("dbi:Oracle:host=$host;sid=$sid", $user, $passwd);

And I'm not sure if that is related to this plugin.
I am setting ORACLE_HOME in the dancer script, so that DBI finds out about the tnsnames.ora
and I don't need to set host and so on but somehow this ENV variable doesn't get used by DBI::Oracle.
It is working for other non dancer scripts with perl.

regards

Andreas

Looks like allowing the sid string (I don't know what that is, offhand) should be easy enough - it'll be this bit of code which assembles the DSN which would need tweaking:

        for (qw(database dbname host port)) {
            if (exists $settings->{$_}) {
                push @extra_args, $_ . "=" . $settings->{$_};
            }
        }
        $dsn .= ':' . join(';', @extra_args) if @extra_args;

In the meantime, though, you can supply a pre-crafted DSN instead which should work?

Hi David,

sid is a kind of db_identifiert alias for the hostname and port

http://search.cpan.org/~pythian/DBD-Oracle-1.52/lib/DBD/Oracle.pm

$dbh = DBI->connect("dbi:Oracle:host=$host;sid=$sid", $user, $passwd);

Probably a keyword like ORACLE_SID would work.
I've got my connection running, with some workaround.

If that is an easy fix would love to see it done.

regards

Andreas

On 10/29/12 21:19, David Precious wrote:

Looks like allowing the |sid| string (I don't know what that is,
offhand) should be easy enough - it'll be this bit of code which
assembles the DSN which would need tweaking:

     for  (qw(database dbname host port))  {
         if  (exists  $settings->{$_})  {
             push  @extra_args,  $_  .  "="  .  $settings->{$_};
         }
     }
     $dsn  .=  ':'  .  join(';',  @extra_args)  if  @extra_args;

In the meantime, though, you can supply a pre-crafted DSN instead
which should work?


Reply to this email directly or view it on GitHub
#36 (comment).

Hi Andreas,

I've got my connection running, with some workaround.
Would you be so kind as to share your workaround since an update to Dancer-Plugin-Database has not been released yet?

Advance Thanks,
Tiffany

Thanks for the reminder of this issue - I'll try to get a new release out shortly with the appropriate fix for you @tyupshaw

@tyupshaw by the way, the workaround I suggested of using a pre-crafted DSN (via the dsn param) instead of the database, host etc params should work for you in the meantime.

Right, done in b3f4cbf and version 2.04 released to CPAN just now.

You can now use sid as a parameter in your config, e.g.:

plugins:
    Database:
        driver: Oracle
        host: localhost
        sid: ABC12

and it will get used in the DSN for you.