I took the approach of creating Rose::DB::Oracle::Proxy as a subclass of
Rose::DB::Oracle.
Then in CMUCS::RAMS::DB:
package CMUCS::RAMS::DB ;
__PACKAGE__->use_private_registry ;
__PACKAGE__->default_domain('development');
__PACKAGE__->default_type('proxy');
__PACKAGE__->driver_class ( 'Oracle-Proxy' =>
'Rose::DB::Oracle::Proxy' ) ;
__PACKAGE__->register_db
( domain => 'development'
, type => 'proxy'
, driver => 'Oracle-Proxy'
, database => undef
, host => '???.svc.cs.cmu.edu'
, port => 7026
, username => '/@devdb'
, password => ''
, connect_options =>
{ sasl => 1
, sasl_mechanism => 'GSSAPI'
, sasl_service => 'sasl-service-name'
, sasl_cb_user => \&getusername
, sasl_cb_auth => \&getusername
, sasl_cb_pass => \&getpassword
, sasl_cb_canonuser => \&canonuser
, sasl_cb_language => 1
}
) ;
I haven't uploaded it to CPAN yet since I haven't had time to complete
the documentation since I am in the middle of a production rollout of a
new application.
As a side note, the reference to SASL in the module documentation
relates to my modified versions of DBD::Proxy and DBI::ProxyServer (and
RPC::PlServer, RPC::PlClient, Net::Daemon) that cleanly handle SASL
authentication. They require a good bit more work before a public
release. First, Authen::SASL::Cyrus itself requires some bug fixes and
updates, then my implementation of IO::Socket::SASL (not to be confused
with IO::Socket::SSL) which they use. Given my current workload, I just
might be able to get started on this by Thanksgiving. If one or more
parties have both an imminent need for SASL authenticated services and
the interest/experience in protocol issues, collaboration could speed up
the process.
- philip
Michael Lackhoff wrote:
Hello,
I am trying to use Rose::DB for a new project that uses an Oracle
database but the connection is done with DBI::Proxy (then I don't have
to install DBD::Oracle on every machine that accesses the database)
After reading the docs the best I could manage was this:
My::DB->register_db(
domain => DOD2::DB->default_domain,
type => DOD2::DB->default_type,
driver => 'Oracle',
dsn => "dbi:Proxy:hostname=myserver;port=12000;dsn=dbi:Oracle:mydb",
username => 'someone',
password => 'secret',
);
But I get this error message:
Attempt to change driver from 'oracle' to 'proxy' detected. The driver
cannot be changed after object creation. at test02.pl line 8
Is it possible to persuade Rose::DB that the 'proxy' still is 'oracle'
or what would a correct register_db look like?
Thanks,
Michael
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object
package Rose::DB::Oracle::Proxy ;
use strict;
use base 'Rose::DB::Oracle' ;
use Rose::DB;
our $Debug = 0;
our $VERSION = '0.01';
sub build_dsn
{
my ( $self_or_class, %args ) = @_ ;
my ( $dsn, $value ) = '' ;
defined ( $value = $args{'host'} || $args{'hostname'} ) &&
( $dsn .= ';hostname=' . $value ) ;
defined ( $value = $args{'port'} ) &&
( $dsn .= ';port=' . $value ) ;
$dsn .= ';dsn=dbi:Oracle:' ;
defined ( $value = $args{'db'} || $args{'database'} ) &&
( $dsn .= $value ) ;
$dsn = 'dbi:Proxy:' . substr($dsn,1) ;
$Debug &&
printf STDERR "[dsn] '%s'\n" ;
$dsn ;
}
sub dbi_driver { 'Oracle-Proxy' }
1;
=head1 NAME
Rose::DB::Oracle::Proxy - Proxied Oracle driver class for Rose::DB.
=head1 SYNOPSIS
use Rose::DB;
Rose::DB->register_db
(
domain => 'development',
type => 'proxy',
driver => 'Oracle-Proxy',
database => 'dev_db',
host => 'remotehost',
username => 'devuser',
password => 'mysecret',
connect_options => { sasl => 1, ... }
...
);
Rose::DB->default_domain('development');
Rose::DB->default_type('proxy');
...
$db = Rose::DB->new; # $db is really a Rose::DB::Oracle::Proxy-derived object
...
=head1 DESCRIPTION
L<Rose::DB> blesses objects into a class derived from
L<Rose::DB::Oracle::Proxy> when the L<driver|Rose::DB/driver> is "oracle".
This mapping of driver names to class names is configurable. See the
documentation for L<Rose::DB>'s L<new()|Rose::DB/new> and
L<driver_class()|Rose::DB/driver_class> methods for more information.
This class cannot be used directly. You must use L<Rose::DB> and let its
L<new()|Rose::DB/new> method return an object blessed into the appropriate
class for you, according to its L<driver_class()|Rose::DB/driver_class>
mappings.
Only the methods that are new or have different behaviors than those in
L<Rose::DB::Oracle> are documented here. See the L<Rose::DB> and
L<Rose::DB::Oracle> documentation for the full list of methods.
B<Note:> This class is a work in progress. Support for Proxied Oracle
databases is not yet complete. If you would like to help, please contact
Philip Dye at [EMAIL PROTECTED] or post to the L<mailing list|Rose::DB/SUPPORT>.
=head1 CLASS METHODS
=over 4
=item B<build_dsn>
...
=back
=head1 AUTHORS
Philip Dye ([EMAIL PROTECTED]), John C. Siracusa ([EMAIL PROTECTED]), Ron
Savage ([EMAIL PROTECTED])
=head1 COPYRIGHT
Copyright (c) 2007 by Philip Dye, John Siracusa and Ron Savage. All rights
reserved. This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object