DBD::pNET - Perl network database driver for the DBI module
use DBI; $dbh = DBI->connect("dbi:pNET:hostname=$host:port=$port:dsn=$db", $user, $passwd); # See the DBI module documentation for full details
DBD::pNET is a Perl module for connecting to a database via a remote DBI driver. This is of course not needed for DBI drivers which already support connecting to a remote database, but there are DBI drivers which work with local databases only, for example DBD::ODBC.
Before connecting to a remote database, you must ensure, that a pNET agent is running on the remote machine. There's no default port, so you have to ask your system administrator for the port number.
Say, your pNET agent 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
$dbh = DBI->connect("DBI:ODBC:mydb", "joe", "hello");
With DBD::pNET this becomes
$dsn = "DBI:pNET:hostname=alpha:port=3334:dsn=DBI:ODBC:mydb"; $dbh = DBI->connect($dsn, "joe", "hello");
You see, this is mainly the same. The DBD::pNET module will create a connection to the pNET agent on "alpha" which in turn will connect to the ODBC database.
DBD::pNET's DSN string has the format
$dsn = "DBI:pNET:key1=val1: ... :keyN=valN:dsn=valDSN";
In other words, it is a collection of key/value pairs. The following keys are recognized:
Hostname and port of the pNET agent; these keys must be present, no defaults. Example:
The value of this attribute will be used as a dsn name by the pNET agent. Thus it must have the format
DBI:driver:..., in particular it will contain colons. For this reason the dsn key must be the last key and its value will be the the complete remaining part of the line, regardless of colons or other characters. Example:
By using these fields you can enable encryption. If you set, for example,
then DBD::pNET will create a new cipher object by executing
$cipherRef = $class->new(pack("H*", $key));
and pass this object to the RPC::pClient module when creating a client. See RPC::pClient(3). Example:
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 host based secret, typically less 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 <pNETagent(3)/CONFIGURATION FILE>.
Turn on debugging mode
Jochen Wiedmann, firstname.lastname@example.org
The DBD::pNET module is Copyright (c) 1997 Jochen Wiedmann. Parts of the sources are based on the DBD::Oracle module. The DBD::Oracle module is Copyright (c) 1995,1996,1997 Tim Bunce. England.
The DBD::pNET module is free software; you can redistribute it and/or modify it under the same terms as Perl itself with the exception that it cannot be placed on a CD-ROM or similar media for commercial distribution without the prior approval of the author.
See also "ACKNOWLEDGEMENTS" in DBI.