MAN page from Old RedHat 5.X DBI-1.08-1.i386.rpm
lib::DBD::Proxy
Section: User Contributed Perl Documentation (3)
Updated: perl 5.005, patch 03
Index NAME
DBD::Proxy - A proxy driver for the DBI
SYNOPSIS
use DBI;
$dbh = DBI->connect("dbi:Proxy:hostname=$host;port=$port;dsn=$db", $user, $passwd); # See the DBI module documentation for full details
DESCRIPTION
DBD::Proxy is a Perl module for connecting to a database via a remoteDBI driver.
This is of course not needed for DBI drivers which alreadysupport connecting to a remote database, but there are engines whichdon't offer network connectivity.
Another application is offering database access through a firewall, asthe driver offers query based restrictions. For example you canrestrict queries to exactly those that are used in a given CGIapplication.
Speaking of CGI, another application is (or rather, will be) to reducethe database connect/disconnect overhead from CGI scripts by usingproxying the connect_cached method. The proxy server will hold thedatabase connections open in a cache. The CGI script then trades thedatabase connect/disconnect overhead for the DBD::Proxyconnect/disconnect overhead which is typically much less.Note that the connect_cached method is new and still experimental.
CONNECTING TO THE DATABASE
Before connecting to a remote database, you must ensure, that a Proxyserver is running on the remote machine. There's no default port, soyou have to ask your system administrator for the port number. Seethe
DBI::ProxyServer(3) manpage for details.
Say, your Proxy server is running on machine ``alpha'', port 3334, andyou'd like to connect to an ODBC database called ``mydb'' as user ``joe''with password ``hello''. When using DBD::ODBC directly, you'd do a
$dbh = DBI->connect("DBI:ODBC:mydb", "joe", "hello");With DBD::Proxy this becomes
$dsn = "DBI:Proxy:hostname=alpha;port=3334;dsn=DBI:ODBC:mydb"; $dbh = DBI->connect($dsn, "joe", "hello");
You see, this is mainly the same. The DBD::Proxy module will create aconnection to the Proxy server on ``alpha'' which in turn will connectto the ODBC database.
Refer to the the DBI(3) manpage documentation on the connect method for a wayto automatically use DBD::Proxy without having to change your code.
DBD::Proxy's DSN string has the format
$dsn = "DBI:Proxy:key1=val1; ... ;keyN=valN;dsn=valDSN";
In other words, it is a collection of key/value pairs. The followingkeys are recognized:
- hostname
- port
- Hostname and port of the Proxy server; these keys must be present,no defaults. Example:
hostname=alpha;port=3334
- dsn
- The value of this attribute will be used as a dsn name by the Proxyserver. Thus it must have the format DBI:driver:..., in particularit will contain colons. The dsn value may contain semicolons, hencethis key *must* be the last and it's value will be the completeremaining part of the dsn. Example:
dsn=DBI:ODBC:mydb
- cipher
- key
- usercipher
- userkey
- By using these fields you can enable encryption. If you set,for example,
cipher=$class:key=$key
then DBD::Proxy will create a new cipher object by executing $cipherRef = $class->new(pack("H*", $key));and pass this object to the RPC::PlClient module when creating aclient. See the RPC::PlClient(3) manpage. Example: cipher=IDEA:key=97cd2375efa329aceef2098babdc9721
The usercipher/userkey attributes allow you to use two phase encryption:The cipher/key encryption will be used in the login and authorisationphase. Once the client is authorised, he will change to usercipher/userkeyencryption. Thus the cipher/key pair is a host based secret, typicallyless secure than the usercipher/userkey secret and readable by anyone.The usercipher/userkey secret is your private secret.Of course encryption requires an appropriately configured server. See<DBD::ProxyServer(3)/CONFIGURATION FILE>.
- debug
- Turn on debugging mode
- stderr
- This attribute will set the corresponding attribute of the RPC::PlClientobject, thus logging will not use syslog(), but redirected to stderr.This is the default under Windows.
stderr=1
- logfile
- Similar to the stderr attribute, but output will be redirected to thegiven file.
logfile=/dev/null
- RowCacheSize
- The DBD::Proxy driver supports this attribute (which is DBI standard,as of DBI 1.02). It's used to reduce network round-trips by fetchingmultiple rows in one go. The current default value is 20, but this maychange.
- proxy_no_finish
- This attribute can be used to reduce network traffic: If theapplication is calling $sth->finish() then the proxy tells the serverto finish the remote statement handle. Of course this slows down thingsquite a lot, but is prefectly good for reducing memory usage withpersistent connections.
However, if you set the proxy_no_finish attribute to a TRUE value,either in the database handle or in the statement handle, then finish()calls will be supressed. This is what you want, for example, in smalland fast CGI applications.
- proxy_quote
- This attribute can be used to reduce network traffic: By default callsto $dbh->quote() are passed to the remote driver. Of course this slowsdown things quite a lot, but is the safest default behaviour.
However, if you set the proxy_quote attribute to the value `local'either in the database handle or in the statement handle, and the callto quote has only one parameter, then the local default DBI quotemethod will be used (which will be faster but may be wrong).
AUTHOR AND COPYRIGHT
This module is Copyright (c) 1997, 1998
Jochen Wiedmann Am Eisteich 9 72555 Metzingen Germany
Email: joeAATTispsoft.de Phone: +49 7123 14887
The DBD::Proxy module is free software; you can redistribute it and/ormodify it under the same terms as Perl itself. In particular permissionis granted to Tim Bunce for distributing this as a part of the DBI.
SEE ALSO
the
DBI(3) manpage, the
RPC::PlClient(3) manpage, the
Storable(3) manpage
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- CONNECTING TO THE DATABASE
- AUTHOR AND COPYRIGHT
- SEE ALSO
This document was created byman2html,using the manual pages.