$ip=getenv(REMOTE_ADDR);
?>
DBMaker Starting Guides
The starting guide for Perl
- Perl
If you have not installed Perl on your system:
- On Unix/Linux:
Obtain perl source file from Perl
HOME and build it.
- On Win9x/NT:
Obtain perl binary from ActiveState
and install it.
- DBI
If you have not installed DBI on your system:
- Obtain DBI source from DBI
web site and install it.
Example:
$ tar zxvf DBI-1.13.tar.gz
Or
$ gunzip DBI-1.13.tar.gz
$ tar xvf DBI-1.13.tar
- After you unpack it, change directory to DBI-1.13 and install
it:
$ cd DBI-1.13
$ perl Makefile.PL
$ make
$ make test
$ make install
- After installing DBI module, you can reference the Perl DBI
specification by:
$ perldoc DBI
- DBD-DBMaker
- Copy DBD-DBMaker driver to your local directory and unpack it.
For example: if current DBD-DBMaker version is 0.14, you can do
as the following:
$ cp ~dbmaker/3.5/driver/Perl/DBD-DBMaker-0.14.tar.gz .
# Unpack the DBD-DBMaker package:
$ tar zxvf DBD-DBMaker-0.14.tar.gz
Or
$ gunzip DBD-DBMaker-0.14.tar.gz
$ tar xvf DBD-DBMaker-0.14.tar
- Change directory to DBD-DBMaker-0.14.
$ cd DBD-DBMaker-0.14
- Make sure to read README file included in the package before
building DBD-DBMaker.
$ perl Makefile.PL
$ make
$ make test
$ make install
- For DBMaker related information about perl DBI methods, please
reference it by:
$ perldoc DBD::DBMaker
Here we illustrate a very simple Perl script for retrieving data in
the database test.
Paste the following Perl code to a file, and name it with the extension
pl (for example: test.pl)
use strict;
use DBI;
##conncet to DB test
my $dbh=DBI->connect( "dbi:DBMaker:test","SYSADM","",
)||die "Database connection not made:$DBI::err
my $sth=$dbh->prepare("select * from t1");
$sth->execute();
###fetch result from t1
while(my @ary=$sth->fetchrow_array) {
print "c1 = $ary[0], c2 = $ary[1]\n";
}
$sth->finish();
$dbh->disconnect();
- Set your environment variable DBMAKER to where you create the "test"
database or where you put dmconfig.ini by:
Example:
If you put your dmconfig.ini in ~/config directory.
sh,bash:
$ export DBMAKER=~/config
csh, tcsh:
$ setenv DBMAKER ~/config
Or you can copy DBMaker config file dmconfig.ini from where
you create "test" database to where you put your perl program.
Example:
If you put your perl program in ~/test
$ cp dmconfig.ini ~/test
- Run the perl script
$ perl test.pl
- The result will be as follows:
c1 = 1, c2 = dbmaker
c1 = 2, c2 = database
- DBD::DBMaker for Perl DBI document
- How to handle BLOB field with Perl
- DBMaker Perl samples
- Perl DBI starting guide (in Chinese)
- Perl Related sites
[ Back To Manuals Index ]
|