Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / man / man3 / DBD::Proxy.3
CommitLineData
86530b38
AT
1.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
129.\" ========================================================================
130.\"
131.IX Title "DBD::Proxy 3"
132.TH DBD::Proxy 3 "2002-10-01" "perl v5.8.0" "User Contributed Perl Documentation"
133.SH "NAME"
134DBD::Proxy \- A proxy driver for the DBI
135.SH "SYNOPSIS"
136.IX Header "SYNOPSIS"
137.Vb 1
138\& use DBI;
139.Ve
140.PP
141.Vb 2
142\& $dbh = DBI->connect("dbi:Proxy:hostname=$host;port=$port;dsn=$db",
143\& $user, $passwd);
144.Ve
145.PP
146.Vb 1
147\& # See the DBI module documentation for full details
148.Ve
149.SH "DESCRIPTION"
150.IX Header "DESCRIPTION"
151DBD::Proxy is a Perl module for connecting to a database via a remote
152\&\s-1DBI\s0 driver.
153.PP
154This is of course not needed for \s-1DBI\s0 drivers which already
155support connecting to a remote database, but there are engines which
156don't offer network connectivity.
157.PP
158Another application is offering database access through a firewall, as
159the driver offers query based restrictions. For example you can
160restrict queries to exactly those that are used in a given \s-1CGI\s0
161application.
162.PP
163Speaking of \s-1CGI\s0, another application is (or rather, will be) to reduce
164the database connect/disconnect overhead from \s-1CGI\s0 scripts by using
165proxying the connect_cached method. The proxy server will hold the
166database connections open in a cache. The \s-1CGI\s0 script then trades the
167database connect/disconnect overhead for the DBD::Proxy
168connect/disconnect overhead which is typically much less.
169\&\fINote that the connect_cached method is new and still experimental.\fR
170.SH "CONNECTING TO THE DATABASE"
171.IX Header "CONNECTING TO THE DATABASE"
172Before connecting to a remote database, you must ensure, that a Proxy
173server is running on the remote machine. There's no default port, so
174you have to ask your system administrator for the port number. See
175\&\fIDBI::ProxyServer\fR\|(3) for details.
176.PP
177Say, your Proxy server is running on machine \*(L"alpha\*(R", port 3334, and
178you'd like to connect to an \s-1ODBC\s0 database called \*(L"mydb\*(R" as user \*(L"joe\*(R"
179with password \*(L"hello\*(R". When using \s-1DBD::ODBC\s0 directly, you'd do a
180.PP
181.Vb 1
182\& $dbh = DBI->connect("DBI:ODBC:mydb", "joe", "hello");
183.Ve
184.PP
185With DBD::Proxy this becomes
186.PP
187.Vb 2
188\& $dsn = "DBI:Proxy:hostname=alpha;port=3334;dsn=DBI:ODBC:mydb";
189\& $dbh = DBI->connect($dsn, "joe", "hello");
190.Ve
191.PP
192You see, this is mainly the same. The DBD::Proxy module will create a
193connection to the Proxy server on \*(L"alpha\*(R" which in turn will connect
194to the \s-1ODBC\s0 database.
195.PP
196Refer to the \s-1\fIDBI\s0\fR\|(3) documentation on the \f(CW\*(C`connect\*(C'\fR method for a way
197to automatically use DBD::Proxy without having to change your code.
198.PP
199DBD::Proxy's \s-1DSN\s0 string has the format
200.PP
201.Vb 1
202\& $dsn = "DBI:Proxy:key1=val1; ... ;keyN=valN;dsn=valDSN";
203.Ve
204.PP
205In other words, it is a collection of key/value pairs. The following
206keys are recognized:
207.IP "hostname" 4
208.IX Item "hostname"
209.PD 0
210.IP "port" 4
211.IX Item "port"
212.PD
213Hostname and port of the Proxy server; these keys must be present,
214no defaults. Example:
215.Sp
216.Vb 1
217\& hostname=alpha;port=3334
218.Ve
219.IP "dsn" 4
220.IX Item "dsn"
221The value of this attribute will be used as a dsn name by the Proxy
222server. Thus it must have the format \f(CW\*(C`DBI:driver:...\*(C'\fR, in particular
223it will contain colons. The \fIdsn\fR value may contain semicolons, hence
224this key *must* be the last and it's value will be the complete
225remaining part of the dsn. Example:
226.Sp
227.Vb 1
228\& dsn=DBI:ODBC:mydb
229.Ve
230.IP "cipher" 4
231.IX Item "cipher"
232.PD 0
233.IP "key" 4
234.IX Item "key"
235.IP "usercipher" 4
236.IX Item "usercipher"
237.IP "userkey" 4
238.IX Item "userkey"
239.PD
240By using these fields you can enable encryption. If you set,
241for example,
242.Sp
243.Vb 1
244\& cipher=$class;key=$key
245.Ve
246.Sp
247(note the semicolon) then DBD::Proxy will create a new cipher object
248by executing
249.Sp
250.Vb 1
251\& $cipherRef = $class->new(pack("H*", $key));
252.Ve
253.Sp
254and pass this object to the RPC::PlClient module when creating a
255client. See \fIRPC::PlClient\fR\|(3). Example:
256.Sp
257.Vb 1
258\& cipher=IDEA;key=97cd2375efa329aceef2098babdc9721
259.Ve
260.Sp
261The usercipher/userkey attributes allow you to use two phase encryption:
262The cipher/key encryption will be used in the login and authorisation
263phase. Once the client is authorised, he will change to usercipher/userkey
264encryption. Thus the cipher/key pair is a \fBhost\fR based secret, typically
265less secure than the usercipher/userkey secret and readable by anyone.
266The usercipher/userkey secret is \fByour\fR private secret.
267.Sp
268Of course encryption requires an appropriately configured server. See
269<\fIDBD::ProxyServer\fR\|(3)/CONFIGURATION \s-1FILE\s0>.
270.IP "debug" 4
271.IX Item "debug"
272Turn on debugging mode
273.IP "stderr" 4
274.IX Item "stderr"
275This attribute will set the corresponding attribute of the RPC::PlClient
276object, thus logging will not use \fIsyslog()\fR, but redirected to stderr.
277This is the default under Windows.
278.Sp
279.Vb 1
280\& stderr=1
281.Ve
282.IP "logfile" 4
283.IX Item "logfile"
284Similar to the stderr attribute, but output will be redirected to the
285given file.
286.Sp
287.Vb 1
288\& logfile=/dev/null
289.Ve
290.IP "RowCacheSize" 4
291.IX Item "RowCacheSize"
292The DBD::Proxy driver supports this attribute (which is \s-1DBI\s0 standard,
293as of \s-1DBI\s0 1.02). It's used to reduce network round-trips by fetching
294multiple rows in one go. The current default value is 20, but this may
295change.
296.IP "proxy_no_finish" 4
297.IX Item "proxy_no_finish"
298This attribute can be used to reduce network traffic: If the
299application is calling \f(CW$sth\fR\->\fIfinish()\fR then the proxy tells the server
300to finish the remote statement handle. Of course this slows down things
301quite a lot, but is prefectly good for reducing memory usage with
302persistent connections.
303.Sp
304However, if you set the \fIproxy_no_finish\fR attribute to a \s-1TRUE\s0 value,
305either in the database handle or in the statement handle, then \fIfinish()\fR
306calls will be supressed. This is what you want, for example, in small
307and fast \s-1CGI\s0 applications.
308.IP "proxy_quote" 4
309.IX Item "proxy_quote"
310This attribute can be used to reduce network traffic: By default calls
311to \f(CW$dbh\fR\->\fIquote()\fR are passed to the remote driver. Of course this slows
312down things quite a lot, but is the safest default behaviour.
313.Sp
314However, if you set the \fIproxy_quote\fR attribute to the value '\f(CW\*(C`local\*(C'\fR'
315either in the database handle or in the statement handle, and the call
316to quote has only one parameter, then the local default \s-1DBI\s0 quote
317method will be used (which will be faster but may be wrong).
318.SH "KNOWN ISSUES"
319.IX Header "KNOWN ISSUES"
320.Sh "Complex handle attributes"
321.IX Subsection "Complex handle attributes"
322Sometimes handles are having complex attributes like hash refs or
323array refs and not simple strings or integers. For example, with
324\&\s-1DBD::CSV\s0, you would like to write something like
325.PP
326.Vb 2
327\& $dbh->{"csv_tables"}->{"passwd"} =
328\& { "sep_char" => ":", "eol" => "\en";
329.Ve
330.PP
331The above example would advice the \s-1CSV\s0 driver to assume the file
332\&\*(L"passwd\*(R" to be in the format of the /etc/passwd file: Colons as
333separators and a line feed without carriage return as line
334terminator.
335.PP
336Surprisingly this example doesn't work with the proxy driver. To understand
337the reasons, you should consider the following: The Perl compiler is
338executing the above example in two steps:
339.IP "1.)" 4
340.IX Item "1.)"
341The first step is fetching the value of the key \*(L"csv_tables\*(R" in the
342handle \f(CW$dbh\fR. The value returned is complex, a hash ref.
343.IP "2.)" 4
344.IX Item "2.)"
345The second step is storing some value (the right hand side of the
346assignment) as the key \*(L"passwd\*(R" in the hash ref from step 1.
347.PP
348This becomes a little bit clearer, if we rewrite the above code:
349.PP
350.Vb 2
351\& $tables = $dbh->{"csv_tables"};
352\& $tables->{"passwd"} = { "sep_char" => ":", "eol" => "\en";
353.Ve
354.PP
355While the examples work fine without the proxy, the fail due to a
356subtile difference in step 1: By \s-1DBI\s0 magic, the hash ref
357\&\f(CW$dbh\fR\->{'csv_tables'} is returned from the server to the client.
358The client creates a local copy. This local copy is the result of
359step 1. In other words, step 2 modifies a local copy of the hash ref,
360but not the server's hash ref.
361.PP
362The workaround is storing the modified local copy back to the server:
363.PP
364.Vb 3
365\& $tables = $dbh->{"csv_tables"};
366\& $tables->{"passwd"} = { "sep_char" => ":", "eol" => "\en";
367\& $dbh->{"csv_tables"} = $tables;
368.Ve
369.SH "AUTHOR AND COPYRIGHT"
370.IX Header "AUTHOR AND COPYRIGHT"
371This module is Copyright (c) 1997, 1998
372.PP
373.Vb 4
374\& Jochen Wiedmann
375\& Am Eisteich 9
376\& 72555 Metzingen
377\& Germany
378.Ve
379.PP
380.Vb 2
381\& Email: joe@ispsoft.de
382\& Phone: +49 7123 14887
383.Ve
384.PP
385The DBD::Proxy module is free software; you can redistribute it and/or
386modify it under the same terms as Perl itself. In particular permission
387is granted to Tim Bunce for distributing this as a part of the \s-1DBI\s0.
388.SH "SEE ALSO"
389.IX Header "SEE ALSO"
390\&\s-1\fIDBI\s0\fR\|(3), \fIRPC::PlClient\fR\|(3), \fIStorable\fR\|(3)