2011-08-25

Slitaz -- perl-dbd-oracle

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#
.

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

.

Slitaz -- lxpanel font


lxpanel font ??

Panel Setting --> Appearance --> Font --> Custom color

1.
litaz-core.iso    2011-Aug-21 04:08:36    30.0M
http://mirror.slitaz.org/iso/rolling/slitaz-core.iso

2.
tux@slitaz:~$ grep color /etc/lxpanel/slitaz/panels/bottom
    tintcolor=#ffffff
    usefontcolor=1
    fontcolor=#ffffff
tux@slitaz:~$ grep color /etc/lxpanel/slitaz/panels/panel
    tintcolor=#ffffff
    usefontcolor=1
    fontcolor=#ffffff
tux@slitaz:~$ grep color .config/lxpanel/slitaz/panels/panel
    tintcolor=#ffffff
    usefontcolor=1
    fontcolor=#ffffff
tux@slitaz:~$ grep color .config/lxpanel/slitaz/panels/bottom
    tintcolor=#ffffff
    usefontcolor=1
    fontcolor=#ffffff

3.
tux@slitaz:~$ grep color .config/lxpanel/slitaz/panels/panel
    tintcolor=#ffffff
    usefontcolor=0
    fontcolor=#ffffff
tux@slitaz:~$ grep color .config/lxpanel/slitaz/panels/bottom
    tintcolor=#ffffff
    usefontcolor=1
    fontcolor=#ffffff
tux@slitaz:~$
.

2011-08-23

Slitaz -- Oracle 10g XE - 2



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");
    print
        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:~$
.

2011-08-18

Slitaz -- Oracle JDeveloper 10g





Oracle JDeveloper
Oracle JDeveloper is a free integrated development environment that simplifies the development of Java-based SOA applications and user interfaces with support for the full development life cycle.

Oracle JDeveloper 10.1.3 Archive
 Oracle JDeveloper 10g (Version 10.1.3.0, build 3673)
Supported on Windows NT/2000/XP, Linux, Solaris, HP-UX, and Macintosh

root@slitaz:~# java -version
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Server VM (build 11.3-b02, mixed mode)
 
root@slitaz:~# /dev/shm/jdev10g/jdev/bin/jdev &
Oracle JDeveloper 10g 10.1.3
Copyright 1997, 2005 Oracle.  All Rights Reserved
.

Slitaz -- Oracle 10g XE



Extract from:

Oracle Database 10g Express Edition
Free to develop, deploy, and distribute

Oracle Database 10g Express Edition (Oracle Database XE) is an entry-level, small-footprint database based on the Oracle Database 10g Release 2 code base. It's free to develop, deploy, and distribute; fast to download; and simple to administer.

Oracle Database XE is a great starter database for:

  • Developers working on PHP, Java, .NET, XML, and Open Source applications
  • DBAs who need a free, starter database for training and deployment
  • Independent Software Vendors (ISVs) and hardware vendors who want a starter database to distribute free of charge
  • Educational institutions and students who need a free database for their curriculum  
[..]

1.
oracle@slitaz:~$ sqlplus

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Aug 18 18:47:27 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Enter user-name: system
Enter password:

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL> select count(*) from hr.employees;

  COUNT(*)
----------
       107

SQL> exit
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

2.
oracle@slitaz:~$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-AUG-2011 19:05:41

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                18-AUG-2011 16:27:27
Uptime                    0 days 2 hr. 38 min. 14 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/nerk/admin/listener.ora
Listener Log File         /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/nerk/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=slitaz)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=8080))(Presentation=P)(Session=RAW))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "XE" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
Service "XEXDB" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
Service "XE_XPT" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
The command completed successfully

3.

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:36583           0.0.0.0:*               LISTEN      8923/xe_d000_XE
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      9078/tnslsnr
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:1521            0.0.0.0:*               LISTEN      9078/tnslsnr
tcp        0      0 :::6000                 :::*                    LISTEN      -
tcp        0      0 :::80                   :::*                    LISTEN      -
tcp        0      0 :::82                   :::*                    LISTEN      -
oracle@slitaz:~$
.


2011-08-16

Slitaz - tazpanel / boot log files


Tazpanel - Boot

Boot log files

X server
[..]
modprobe: module fbcon not found in modules.dep
/usr/bin/xauth:  file /home/tux/.Xauthority does not exist
DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/dbus-wACNhb8CyN,guid=f7233b62925ae37beecafc1300000ea5
DBUS_SESSION_BUS_PID=3145
DBUS_SESSION_BUS_WINDOWID=8388609
cat: can't open '/var/lib/tazpkg/packages.up': No such file or directory

** (:1588): WARNING **: Error loading plugin: libaspell.so.15: cannot open shared object file: No such file or directory

** Message: console message: http://tazpanel:82/ @11: TypeError: Result of expression 'document.getElementById("loading")' [null] is not an object.

** Message: console message: http://tazpanel:82/pkgs.cgi @11: TypeError: Result of expression 'document.getElementById("loading")' [null] is not an object.
[..]


1.
root@slitaz:~# modinfo fbcon
filename:       fbcon

2.
root@slitaz:~# ls -l /home/tux/.Xauthority
-rw-------    1 tux      users           51 Aug 16 17:54 /home/tux/.Xauthority

3.
root@slitaz:~# ps ax | grep 1588
 1588 tux        0:07 tazweb http://tazpanel:82/
 2487 root       0:00 grep 1588

4.
root@slitaz:~# ls /var/lib/tazpkg
files.list.lzma      mirrors              packages.list
files.list.lzma.bak  packages.desc        packages.list.bak
ID                   packages.desc.bak    packages.md5
installed            packages.diff        packages.md5.bak
installed.md5        packages.equiv       packages.txt
mirror               packages.equiv.bak   packages.txt.bak

5.
tux@slitaz:~$ tazpkg info aspell

Tazpkg information
================================================================================
Package    : aspell
Version    : 0.60.6
Category   : system-tools
Short desc : GNU spell checker.
Maintainer : paul@slitaz.org
Depends    : ncurses gcc-lib-base
Web site   : http://aspell.net/
================================================================================

tux@slitaz:~$ tazpkg search-file libaspell.so

Search result for file libaspell.so
================================================================================

Package aspell:
/usr/lib/libaspell.so.15.1.4
/usr/lib/libaspell.so
/usr/lib/libaspell.so.15

================================================================================
3 file(s) found for: libaspell.so

tux@slitaz:~$