BuildDSN format in Oracle/DBIx::SearchBuilder

Does anyone have an opinion on the best connect method for
SearchBuilder and Oracle?

When I manually use DBI, I generally use:
my $oracle_data_source = “dbi:Oracle:DEV9I.host.domain.edu.au”;
my $oracle_username = “USER”;
my $oracle_auth = “PASS”;
$dbh = DBI->connect($oracle_data_source, $oracle_username,
$oracle_auth, { AutoCommit => 1 });

resulting in Oracle using the information from TNSNAMES, but
SearchBuilder likes to create a DSN in the format:

'dbi:Oracle:dbname=DEV9I;host=localhost'

which is insufficient for an Oracle connection - as you need to provide
a SID and Hostname. Are there any objections by DBIx::SearchBuilder
users in changing the default behaviour? Patch attached for any
interested people. I just don’t want to rock the boat of any SB users
outside of the RT community which could have problems with this change.

Jesse, others, what are your thoughts?

Logic would change to (only for the Oracle Handle):

  • my $dsn = “dbi:$args{‘Driver’}:”;
  • if (defined $args{‘Host’} && $args{‘Host’}
  • && defined $args{‘SID’} && $args{‘SID’} ) {
  •  $dsn .= "host=$args{'Host'};sid=$args{'SID'}";
    
  • } else {
  •  $dsn .= "$args{'Database'}" if (defined $args{'Database'} && 
    

$args{‘Database’});

  • }
  • $dsn .= “;port=$args{‘Port’}” if (defined $args{‘Port’} &&
    $args{‘Port’});
  • $dsn .= “;requiressl=1” if (defined $args{‘RequireSSL’} &&
    $args{‘RequireSSL’});
  • $self->{‘dsn’}= $dsn;

to build either a Database based version (if a database is specified)
or a SID/Host based DSN. If you haven’t noticed from my enquiry Oracle
support is nearing completion - at least I think so - but the rigorous
testing is something that will be left as an exercise to the reader.

Watch this space!

-Brook