complie perl module DBD::Oracle
# perl Makefile.PL
# make
# make install
1.
oracle@slitaz:~$ tazpkg list | grep perl
perl 5.12.3 development
perl-dbi-dbd 1.607 development
perl-uri 1.58 development
perl-xml-parser 2.40 development
perl-xml-simple 2.18 development
oracle@slitaz:~$
2.
http://cpan.stu.edu.tw/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.29_1.tar.gz
http://cpan.stu.edu.tw/modules/by-module/DBD/DBD-Oracle-1.28.tar.gz
3.
root@slitaz:/usr/src/DBD-Oracle-1.29_1# perl Makefile.PL
Using DBI 1.607 (for perl 5.012003 on i686-linux) installed in /usr/lib/perl5/site_perl/5.12.3/i686-linux/auto/DBI/
Configuring DBD::Oracle for perl 5.012003 on linux (i686-linux)
Remember to actually *READ* the README file! Especially if you have any problems.
Installing on a linux, Ver#2.6
Using Oracle in /usr/lib/oracle/xe/app/oracle/product/10.2.0/server
DEFINE _SQLPLUS_RELEASE = "1002000100" (CHAR)
Oracle version 10.2.0.1 (10.2)
Found /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/demo/demo_xe.mk
Using /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/demo/demo_xe.mk
Looks like Oracle XE (/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/demo/demo_xe.mk)
Reading /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/demo/demo_xe.mk
Your LD_LIBRARY_PATH env var is set to '/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib:'
client_version=10.2
DEFINE= -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"10.2.0.1\" -DORA_OCI_102
Checking for functioning wait.ph
System: perl5.012003 linux tank 2.6.30.6-slitaz #1 smp thu apr 8 21:19:10 cest 2010 i686 gnulinux
Compiler: cc -O2 -march=i486 -Os -pipe -fomit-frame-pointer -fno-strict-aliasing -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
Linker: /usr/bin/ld
Sysliblist: -ldl -lm -lpthread -lnsl -lirc
Oracle makefiles would have used these definitions but we override them:
CC: /usr/bin/gcc
LDFLAGS: -g
[-g]
Linking with -L/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/ -lclntsh -lpthread
WARNING: If you have problems you may need to rebuild perl with threading enabled.
Checking if your kit is complete...
Looks good
LD_RUN_PATH=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib
Using DBD::Oracle 1.29_1.
Using DBD::Oracle 1.29_1.
Using DBI 1.607 (for perl 5.012003 on i686-linux) installed in /usr/lib/perl5/site_perl/5.12.3/i686-linux/auto/DBI/
Writing Makefile for DBD::Oracle
*** If you have problems...
read all the log printed above, and the README and README.help.txt files.
(Of course, you have read README by now anyway, haven't you?)
root@slitaz:/usr/src/DBD-Oracle-1.29_1#
4.
root@slitaz:/usr/src/DBD-Oracle-1.29_1# make
cp Oracle.pm blib/lib/DBD/Oracle.pm
cp oraperl.ph blib/lib/oraperl.ph
cp dbdimp.h blib/arch/auto/DBD/Oracle/dbdimp.h
cp ocitrace.h blib/arch/auto/DBD/Oracle/ocitrace.h
cp Oraperl.pm blib/lib/Oraperl.pm
cp Oracle.h blib/arch/auto/DBD/Oracle/Oracle.h
cp lib/DBD/Oracle/Object.pm blib/lib/DBD/Oracle/Object.pm
cp mk.pm blib/arch/auto/DBD/Oracle/mk.pm
cp lib/DBD/Oracle/GetInfo.pm blib/lib/DBD/Oracle/GetInfo.pm
/usr/bin/perl -p -e "s/~DRIVER~/Oracle/g" /usr/lib/perl5/site_perl/5.12.3/i686-linux/auto/DBI/Driver.xst > Oracle.xsi
/usr/bin/perl /usr/lib/perl5/5.12.3/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.12.3/ExtUtils/typemap -typemap typemap Oracle.xs > Oracle.xsc && mv Oracle.xsc Oracle.c
cc -c -I/usr/lib/perl5/site_perl/5.12.3/i686-linux/auto/DBI -I/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/public/ -DLINUX -D_GNU_SOURCE -D_REENTRANT -g -march=i486 -Os -pipe -fomit-frame-pointer -fno-strict-aliasing -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"1.29_1\" -DXS_VERSION=\"1.29_1\" -fPIC "-I/usr/lib/perl5/5.12.3/i686-linux/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"10.2.0.1\" -DORA_OCI_102 Oracle.c
cc -c -I/usr/lib/perl5/site_perl/5.12.3/i686-linux/auto/DBI -I/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/public/ -DLINUX -D_GNU_SOURCE -D_REENTRANT -g -march=i486 -Os -pipe -fomit-frame-pointer -fno-strict-aliasing -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"1.29_1\" -DXS_VERSION=\"1.29_1\" -fPIC "-I/usr/lib/perl5/5.12.3/i686-linux/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"10.2.0.1\" -DORA_OCI_102 dbdimp.c
cc -c -I/usr/lib/perl5/site_perl/5.12.3/i686-linux/auto/DBI -I/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/public/ -DLINUX -D_GNU_SOURCE -D_REENTRANT -g -march=i486 -Os -pipe -fomit-frame-pointer -fno-strict-aliasing -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"1.29_1\" -DXS_VERSION=\"1.29_1\" -fPIC "-I/usr/lib/perl5/5.12.3/i686-linux/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"10.2.0.1\" -DORA_OCI_102 oci8.c
oci8.c: In function ‘ora_blob_read_mb_piece’:
oci8.c:1781:4: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 6 has type ‘ub4’
Running Mkbootstrap for DBD::Oracle ()
chmod 644 Oracle.bs
rm -f blib/arch/auto/DBD/Oracle/Oracle.so
LD_RUN_PATH="/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib" cc -shared -O2 -fstack-protector Oracle.o dbdimp.o oci8.o -o blib/arch/auto/DBD/Oracle/Oracle.so \
-L/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/ -lclntsh -lpthread \
chmod 755 blib/arch/auto/DBD/Oracle/Oracle.so
cp Oracle.bs blib/arch/auto/DBD/Oracle/Oracle.bs
chmod 644 blib/arch/auto/DBD/Oracle/Oracle.bs
/usr/bin/perl "-Iblib/arch" "-Iblib/lib" ora_explain.PL ora_explain
Extracted ora_explain from ora_explain.PL with variable substitutions.
cp ora_explain blib/script/ora_explain
/usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/ora_explain
root@slitaz:/usr/src/DBD-Oracle-1.29_1#
5.
root@slitaz:/usr/src/DBD-Oracle-1.29_1# make install
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/lib/perl5/site_perl/5.12.3/i686-linux/auto/DBD/Oracle/Oracle.h
Installing /usr/lib/perl5/site_perl/5.12.3/i686-linux/auto/DBD/Oracle/dbdimp.h
Installing /usr/lib/perl5/site_perl/5.12.3/i686-linux/auto/DBD/Oracle/Oracle.bs
Installing /usr/lib/perl5/site_perl/5.12.3/i686-linux/auto/DBD/Oracle/ocitrace.h
Installing /usr/lib/perl5/site_perl/5.12.3/i686-linux/auto/DBD/Oracle/Oracle.so
Installing /usr/lib/perl5/site_perl/5.12.3/i686-linux/auto/DBD/Oracle/mk.pm
Installing /usr/lib/perl5/site_perl/5.12.3/i686-linux/oraperl.ph
Installing /usr/lib/perl5/site_perl/5.12.3/i686-linux/Oraperl.pm
Installing /usr/lib/perl5/site_perl/5.12.3/i686-linux/DBD/Oracle.pm
Installing /usr/lib/perl5/site_perl/5.12.3/i686-linux/DBD/Oracle/GetInfo.pm
Installing /usr/lib/perl5/site_perl/5.12.3/i686-linux/DBD/Oracle/Object.pm
Installing /usr/bin/ora_explain
Appending installation info to /usr/lib/perl5/5.12.3/i686-linux/perllocal.pod
root@slitaz:/usr/src/DBD-Oracle-1.29_1#
.
Showing posts with label perl. Show all posts
Showing posts with label perl. Show all posts
2011-08-25
Slitaz -- Oracle XE 10g - perl
1.
oracle@slitaz:~$ perl oraxe-query.pl
Beijing
Bern
Bombay
Geneva
Hiroshima
London
Mexico City
Munich
Oxford
Roma
Sao Paulo
Seattle
Singapore
South Brunswick
South San Francisco
Southlake
Stretford
Sydney
Tokyo
Toronto
Utrecht
Venice
Whitehorse
2.
oracle@slitaz:~$ cat oraxe-query.pl
#!/usr/bin/perl
use DBI;
use strict;
use vars qw($dbh $sth);
# get a database handle
$dbh = DBI->connect('dbi:Oracle:', 'hr@localhost/XE', 'oracle');
# get a statement handle
$sth=$dbh->prepare('SELECT city FROM locations');
# execute the statement handle
$sth->execute();
# loop through the results
while (my ($r_city) = $sth->fetchrow())
{
print " $r_city \n";
}
$sth->finish();
$dbh->disconnect();
oracle@slitaz:~$
3.
Extract from
An Introduction to DBD::Oracle
[..]
4 Using DBI and DBD::Oracle
4.1 Understanding DBI
Since its inception by Tim Bunce in 1994, DBI (DataBase Interface) has been the de facto standard for interfacing databases with the Perl language. Thanks to the designers' foresight, DBI is database-independent, with methods, variables, and conventions that provide a consistent programming interface, no matter what database management system is being used.
As an API, DBI is just an interface to a database driver--in our case, DBD::Oracle--so you can think of DBI as the glue that links the Perl language to a specific database driver, as seen in the diagram below.
DBD::Oracle Diagram
.
2011-08-23
Slitaz -- Oracle XE - perl - lighttpd
Oracle 10g XE + DBD::Oracle + FastCGI
Fast CGI on Lighttpd
Invocation number 4 PID 14231.Requested uri is /index.html
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
1.
oracle@slitaz:~$ ps ax | grep httpd
14221 www 0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
14222 www 0:00 /usr/bin/perl /usr/bin/lighttpd.fcgi
14225 www 0:00 /usr/bin/perl /usr/bin/lighttpd.fcgi
14228 www 0:00 /usr/bin/perl /usr/bin/lighttpd.fcgi
14231 www 0:00 /usr/bin/perl /usr/bin/lighttpd.fcgi
14239 root 0:00 leafpad /var/log/lighttpd/error.log
14376 oracle 0:00 grep httpd
2.
oracle@slitaz:~$ ls /tmp/fastcgi.socket*
/tmp/fastcgi.socket-0 /tmp/fastcgi.socket-2
/tmp/fastcgi.socket-1 /tmp/fastcgi.socket-3
3.
oracle@slitaz:~$ cat /usr/bin/lighttpd.fcgi
#!/usr/bin/perl
use CGI::Fast qw(:standard);
use DBI;
use URI;
$ENV{FCGI_SOCKET_PATH} = "/tmp/fastcgi.socket";
$ENV{FCGI_LISTEN_QUEUE} = 100;
$COUNTER = 0;
my $dbh = DBI->connect('dbi:Oracle:', 'hr@localhost/XE', 'oracle') || die ;
while (new CGI::Fast) {
print header;
print start_html("Fast CGI Rocks");
h1("Fast CGI on Lighttpd"),
"Invocation number ",b($COUNTER++),
" PID ",b($$),".",
hr;
my $uri = URI->new( $ENV{REQUEST_URI} );
print br;
print "Requested uri is ",b($uri);
my $sql = 'SELECT * from v$version';
my $sth = $dbh->prepare($sql);
$sth->execute();
while (my (@s) = $sth->fetchrow_array())
{
print br;
print b($s[0]);
}
print end_html;
}
4.
oracle@slitaz:~$ netstat -nltp
netstat: showing only processes with your user ID
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 10723/tnslsnr
tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN 10723/tnslsnr
tcp 0 0 0.0.0.0:55037 0.0.0.0:* LISTEN 10749/xe_d000_XE
tcp 0 0 :::6000 :::* LISTEN -
oracle@slitaz:~$
.



