home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>DBD::Proxy - A proxy driver for the DBI</TITLE>
- <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> DBD::Proxy - A proxy driver for the DBI</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#connecting to the database">CONNECTING TO THE DATABASE</A></LI>
- <LI><A HREF="#author and copyright">AUTHOR AND COPYRIGHT</A></LI>
- <LI><A HREF="#see also">SEE ALSO</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>DBD::Proxy - A proxy driver for the DBI</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <PRE>
- use DBI;</PRE>
- <PRE>
- $dbh = DBI->connect("dbi:Proxy:hostname=$host;port=$port;dsn=$db",
- $user, $passwd);</PRE>
- <PRE>
- # See the DBI module documentation for full details</PRE>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>DBD::Proxy is a Perl module for connecting to a database via a remote
- DBI driver.</P>
- <P>This is of course not needed for DBI drivers which already
- support connecting to a remote database, but there are engines which
- don't offer network connectivity.</P>
- <P>Another application is offering database access through a firewall, as
- the driver offers query based restrictions. For example you can
- restrict queries to exactly those that are used in a given CGI
- application.</P>
- <P>Speaking of CGI, another application is (or rather, will be) to reduce
- the database connect/disconnect overhead from CGI scripts by using
- proxying the connect_cached method. The proxy server will hold the
- database connections open in a cache. The CGI script then trades the
- database connect/disconnect overhead for the DBD::Proxy
- connect/disconnect overhead which is typically much less.
- <EM>Note that the connect_cached method is new and still experimental.</EM></P>
- <P>
- <HR>
- <H1><A NAME="connecting to the database">CONNECTING TO THE DATABASE</A></H1>
- <P>Before connecting to a remote database, you must ensure, that a Proxy
- server is running on the remote machine. There's no default port, so
- you have to ask your system administrator for the port number. See
- <A HREF="../../../DBI/ProxyServer(3).html">the DBI::ProxyServer(3) manpage</A> for details.</P>
- <P>Say, your Proxy server is running on machine ``alpha'', port 3334, and
- you'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</P>
- <PRE>
- $dbh = DBI->connect("DBI:ODBC:mydb", "joe", "hello");</PRE>
- <P>With DBD::Proxy this becomes</P>
- <PRE>
- $dsn = "DBI:Proxy:hostname=alpha;port=3334;dsn=DBI:ODBC:mydb";
- $dbh = DBI->connect($dsn, "joe", "hello");</PRE>
- <P>You see, this is mainly the same. The DBD::Proxy module will create a
- connection to the Proxy server on ``alpha'' which in turn will connect
- to the ODBC database.</P>
- <P>Refer to the <EM>DBI(3)</EM> documentation on the <A HREF="../../../lib/Pod/perlfunc.html#item_connect"><CODE>connect</CODE></A> method for a way
- to automatically use DBD::Proxy without having to change your code.</P>
- <P>DBD::Proxy's DSN string has the format</P>
- <PRE>
- $dsn = "DBI:Proxy:key1=val1; ... ;keyN=valN;dsn=valDSN";</PRE>
- <P>In other words, it is a collection of key/value pairs. The following
- keys are recognized:</P>
- <DL>
- <DT><STRONG><A NAME="item_hostname">hostname</A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_port">port</A></STRONG><BR>
- <DD>
- Hostname and port of the Proxy server; these keys must be present,
- no defaults. Example:
- <PRE>
- hostname=alpha;port=3334</PRE>
- <P></P>
- <DT><STRONG><A NAME="item_dsn">dsn</A></STRONG><BR>
- <DD>
- The value of this attribute will be used as a dsn name by the Proxy
- server. Thus it must have the format <CODE>DBI:driver:...</CODE>, in particular
- it will contain colons. The <EM>dsn</EM> value may contain semicolons, hence
- this key *must* be the last and it's value will be the complete
- remaining part of the dsn. Example:
- <PRE>
- dsn=DBI:ODBC:mydb</PRE>
- <P></P>
- <DT><STRONG><A NAME="item_cipher">cipher</A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_key">key</A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_usercipher">usercipher</A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_userkey">userkey</A></STRONG><BR>
- <DD>
- By using these fields you can enable encryption. If you set,
- for example,
- <PRE>
- cipher=$class;key=$key</PRE>
- <P>(note the semicolon) then DBD::Proxy will create a new cipher object
- by executing</P>
- <PRE>
- $cipherRef = $class->new(pack("H*", $key));</PRE>
- <P>and pass this object to the RPC::PlClient module when creating a
- client. See <A HREF="../../../RPC/PlClient(3).html">the RPC::PlClient(3) manpage</A>. Example:</P>
- <PRE>
- cipher=IDEA;key=97cd2375efa329aceef2098babdc9721</PRE>
- <P>The usercipher/userkey attributes allow you to use two phase encryption:
- The cipher/key encryption will be used in the login and authorisation
- phase. Once the client is authorised, he will change to usercipher/userkey
- encryption. Thus the cipher/key pair is a <STRONG>host</STRONG> based secret, typically
- less secure than the usercipher/userkey secret and readable by anyone.
- The usercipher/userkey secret is <STRONG>your</STRONG> private secret.</P>
- <P>Of course encryption requires an appropriately configured server. See
- <DBD::ProxyServer(3)/CONFIGURATION FILE>.</P>
- <P></P>
- <DT><STRONG><A NAME="item_debug">debug</A></STRONG><BR>
- <DD>
- Turn on debugging mode
- <P></P>
- <DT><STRONG><A NAME="item_stderr">stderr</A></STRONG><BR>
- <DD>
- This attribute will set the corresponding attribute of the RPC::PlClient
- object, thus logging will not use syslog(), but redirected to stderr.
- This is the default under Windows.
- <PRE>
- stderr=1</PRE>
- <P></P>
- <DT><STRONG><A NAME="item_logfile">logfile</A></STRONG><BR>
- <DD>
- Similar to the stderr attribute, but output will be redirected to the
- given file.
- <PRE>
- logfile=/dev/null</PRE>
- <P></P>
- <DT><STRONG><A NAME="item_RowCacheSize">RowCacheSize</A></STRONG><BR>
- <DD>
- 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 fetching
- multiple rows in one go. The current default value is 20, but this may
- change.
- <P></P>
- <DT><STRONG><A NAME="item_proxy_no_finish">proxy_no_finish</A></STRONG><BR>
- <DD>
- This attribute can be used to reduce network traffic: If the
- application is calling $sth-><CODE>finish()</CODE> then the proxy tells the server
- to finish the remote statement handle. Of course this slows down things
- quite a lot, but is prefectly good for reducing memory usage with
- persistent connections.
- <P>However, if you set the <EM>proxy_no_finish</EM> attribute to a TRUE value,
- either in the database handle or in the statement handle, then <CODE>finish()</CODE>
- calls will be supressed. This is what you want, for example, in small
- and fast CGI applications.</P>
- <P></P>
- <DT><STRONG><A NAME="item_proxy_quote">proxy_quote</A></STRONG><BR>
- <DD>
- This attribute can be used to reduce network traffic: By default calls
- to $dbh-><CODE>quote()</CODE> are passed to the remote driver. Of course this slows
- down things quite a lot, but is the safest default behaviour.
-
- <PRE>
-
- However, if you set the I<proxy_quote> attribute to the value 'C<local>'
- either in the database handle or in the statement handle, and the call
- to quote has only one parameter, then the local default DBI quote
- method will be used (which will be faster but may be wrong).</PRE>
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="author and copyright">AUTHOR AND COPYRIGHT</A></H1>
- <P>This module is Copyright (c) 1997, 1998</P>
- <PRE>
- Jochen Wiedmann
- Am Eisteich 9
- 72555 Metzingen
- Germany</PRE>
- <PRE>
- Email: joe@ispsoft.de
- Phone: +49 7123 14887</PRE>
- <P>The DBD::Proxy module is free software; you can redistribute it and/or
- modify it under the same terms as Perl itself. In particular permission
- is granted to Tim Bunce for distributing this as a part of the DBI.</P>
- <P>
- <HR>
- <H1><A NAME="see also">SEE ALSO</A></H1>
- <P><EM>DBI(3)</EM>, <A HREF="../../../RPC/PlClient(3).html">the RPC::PlClient(3) manpage</A>, <EM>Storable(3)</EM></P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> DBD::Proxy - A proxy driver for the DBI</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-