Web development involves two aspects: layout and content.
On the layout, the CGI Module of PERL is powerful and easy to use. In just a few lines, HTML webpages can be dynamically generated.
To be fair, you must use a database to manage the content. PERL supports a wide range of databases, and almost all mainstream databases have corresponding PERL module support. In order to develop PERL applications that can be transplanted to different databases, the DBI (DataBase Interface) module came into being. Using this module, applications can operate different databases only by using a unified Interface, it is truly portable. Of course, this DBI is also equipped with corresponding switches to support various features of different databases. Each database can be written separately. This article does not cover this point for the time being.
DBI is only an abstraction layer. To support different databases, you must write drivers for different databases under DBI. For MySql, there are DBD: Mysql, and for Oracle, It is DBD: Oracle. DBD is short for DataBase Driver.
The overall architecture is as follows:
Application> DBI> DBD> DB
To connect to different types of databases, You have to configure and install DBI and the corresponding DBD module on the host where the application is located. You can refer to this article for the installation and configuration of DBI, I will not re-build the wheel. The installation sequence is to first install DBI and then install DBD: Oracle.
DBD: The Oracle module is not officially developed by Oracle, but developed by Pythian Group, a famous DBA consulting company. The latest version is 1.22.
Next we will list the steps for installing DBD: Oracle as follows for your reference.
DBD: The Oracle module can be installed either on a host with an Oracle Database or on a host without an Oracle Database. The latter requires the Oracle Instant Client to be installed for remote Database connection, this article only focuses on the second configuration, that is, DBD: Oracle implements database access through the Instant Client.
Step 1: Download the Oracle Instant Client
Oracle Instant Client home page in http://www.oracle.com/technology/tech/oci/instantclient/index.html; Adhering to the Oracle company's consistent practice, the same software is divided into different Downloadable packages by configuration, so that users can according to their own needs, find the most appropriate part to download. To successfully configure DBD: Oracle, Basic, SQL * Plus, and SDK, You need to download these three packages and put them in the same directory, the three packages I have downloaded are as follows: the latest version is 11.1.0.7.
Shawn @ shawn-laptop:/tmp/InstantClient $ ls
Instantclient-basic-linux32-11.1.0.7.zip
Instantclient-sdk-linux32-11.1.0.7.zip
Instantclient-sqlplus-linux32-11.1.0.7.zip
Decompress the three zip files in the current directory by running the unzip command. The instantclient_11_1 directory is automatically generated. All the files in the preceding three packages are included in the package. The decompressed directory structure is as follows:
Shawn @ shawn-laptop:/tmp/InstantClient $ ls
Instantclient_11_1
Instantclient-basic-linux32-11.1.0.7.zip
Instantclient-sdk-linux32-11.1.0.7.zip
Instantclient-sqlplus-linux32-11.1.0.7.zip
At this time, the three zip files are useless and can be deleted or backed up for reuse in the future.
Step 2: Download DBD: Oracle
At this time, we can use the PERL built-in CPAN for automatic installation, or you can manually download this module, compile and install it, This article uses the latter.
DBD: Oracle's region at search.cpan.org is:
Shawn @ shawn-laptop:/tmp $ tarzxf DBD-Oracle-1.22.tar.gzDBD-Oracle-1.22shawn @ shawn-laptop:/tmp/DBD-Oracle-1.22 $ lsChanges Makefile. PL oraperl. ph README.login.txt dbdimp. c MANIFEST Oraperl. pm README.longs.txt [.. omitted part of screen output...]
Step 3: configure the ORACLE_HOME Environment Variable
If the Oracle Database software is installed, ORACLE_HOME is the value set when oracle is installed. When only the Instant Client is installed, this value is set to the absolute path of the instantclient_11_1 directory in step 1, as follows:
Shawn @ shawn-laptop:/tmp/DBD-Oracle-1.22 $ exportORACLE_HOME =/tmp/InstantClient/instantclient_11_1
Shawn @ shawn-laptop:/tmp/DBD-Oracle-1.22 $ echo $ ORACLE_HOME
/Tmp/InstantClient/instantclient_11_1
Step 4: Compile and install the DBD: Oracle Module
First, generate Makefile using PERL makefile. PL.
Shawn @ shawn-laptop:/tmp/DBD-Oracle-1.22 $ perl Makefile. PLUsing DBI 1.607 (for perl 5.008008 on i486-linux-gnu-thread-multi) installed in/usr/local/lib/perl/5.8.8/auto/DBI/loading ing DBD: Oracle for perl 5.008008 on linux (i486-linux-gnu-thread-multi) remember to actually * READ * the README file! Especially if you have any problems.
Installing on a linux, Ver #2.6
Using Oracle in/tmp/InstantClient/instantclient_11_1
DEFINE _ SQLPLUS_RELEASE = "1101000700" (CHAR)
Oracle version 11.1.0.7 (11.1)
Looks like an Instant Client installation, okay
[... Omitted some screen output...]
Run make
Shawn @ shawn-laptop:/tmp/DBD-Oracle-1.22 $ makecp Oracle. pm blib/lib/DBD/Oracle. pmcp oraperl. ph blib/lib/oraperl. phcp dbdimp. h blib/arch/auto/DBD/Oracle/dbdimp. hI/Driver. xst> Oracle. xsi [.. omitted part of screen output...]
Then switch to the root user make install
Shawn @ shawn-laptop:/tmp/DBD-Oracle-1.22 $ suPassword: root @ shawn-laptop:/tmp/DBD-Oracle-1.22 # make install [... omitted partial screen output...]
So far, DBD: After Oracle configuration and installation is complete, you can use this module to connect to Oracle for corresponding operations,