Database-SQL-RDBMS HOW-TO document for Linux (PostgreSQL
Object Relational Database System)
Al Dev (Alavoor Vasudevan) alavoor@yahoo.com
v11.0, 8 January 1999
This document is a "practical guide" to very quickly setup a SQL
Database engine and front end tools on a Unix system. It also dis
cusses the International standard language ANSI/ISO SQL and reviews
the merits/advantages of the SQL database engine developed by the
world-wide internet in an "open development" environment. It is about
HOW-TO setup a next generation Object Relational SQL Database "Post
greSQL" on Unix system which can be used as a Application Database
Server or as a Web Database Server. PostgreSQL implements a subset of
International ISO/ANSI SQL standards of years 1998,92,89. This docu
ment also gives information on the database interface programs like
Front End GUIs, RAD tools (Rapid Application Development), ODBC, JDBC
drivers, "C", "C++", Java, Perl programming interfaces and Web
Database Tools. Information given here applies to all Unix platforms
and to all other SQL databases. It will be very useful for people who
are new to Databases, SQL language and PostgreSQL. This document also
has SQL tutorial, SQL syntax which would be very helpful for begin
ners. Experienced people will find this document as a useful reference
guide. For students, the information given here will enable them to
get the source code for PostgreSQL relational database system, from
which they can learn as to how a RDBMS SQL database engine is created.
______________________________________________________________________
Table of Contents
1. Introduction
2. Other Formats of this Document
3. Laws of Physics applies to Software!
4. What is PostgreSQL ?
5. Where to get it ?
6. PostgreSQL Supports Extremely Large Databases greater than 200 Gig
7. How can I trust PostgreSQL ? Regression Test Package builds customer confidence
8. GUI FrontEnd Tool for PostgreSQL (Graphical User Interface)
9. Integrated Development Environment Tools for PostgreSQL (GUI IDE)
10. Interface Drivers for PostgreSQL
10.1 ODBC Drivers for PostgreSQL
10.2 UDBC Drivers for PostgreSQL
10.3 JDBC Drivers for PostgreSQL
10.4 Java for PostgreSQL
11. Perl Database Interface (DBI) Driver for PostgreSQL
11.1 Perl 5 interface for PostgreSQL
11.2 Perl Database Interface DBI
11.2.1 WHAT IS DBI ?
11.2.2 DBI driver for PostgreSQL DBD-Pg-0.89
11.2.3 Technical support for DBI
11.2.4 What is DBI, DBperl, Oraperl and *perl?
11.2.5 DBI specifications
11.2.6 Compilation problems or "It fails the test"
11.2.7 Is DBI supported under Windows 95 / NT platforms?
11.2.8 What's DBM? And why use DBI instead ?
11.2.9 Is < insert feature here > supported in DBI?
11.2.10 Is DBI any use for CGI programming?
11.2.11 How do I get faster connection times with DBD Oracle and CGI?
11.2.12 How do I get persistent connections with DBI and CGI?
11.2.13 ``When I run a perl script from the command line, it works, but, when I run it under the httpd, it fails!'' Why?
11.2.14 Can I do multi-threading with DBI?
11.2.15 How can I invoke stored procedures with DBI?
11.2.16 How can I get return values from stored procedures with DBI?
11.2.17 How can I create or drop a database with DBI?
11.2.18 How are NULL values handled by DBI?
11.2.19 What are these func methods all about?
11.2.20 Commercial Support and Training
12. PostgreSQL Management Tools
12.1 PGACCESS - A GUI Tool for PostgreSQL Management
12.2 Windows Interactive Query Tool for PostgreSQL (WISQL or MPSQL)
12.3 Interactive Query Tool (ISQL) for PostgreSQL called PSQL
12.4 MPMGR - A Database Management Tool for PostgresSQL
13. Setting up multi-boxes PostgreSQL with just one monitor
14. Applications and Tools for PostgreSQL
14.1 PostgreSQL 4GL for web database applications - AppGEN Development System
14.2 WWW Web interface for PostgresSQL - DBENGINE
14.3 Apache Webserver Module for PostgreSQL - NeoSoft NeoWebScript
14.4 HEITML server side extension of HTML and a 4GL language for PostgreSQL
14.5 America On-line AOL Web server for PostgreSQL
14.6 Problem/Project Tracking System Application Tool for PostgreSQL
14.7 Convert dbase dbf files to PostgreSQL
15. Web Database Design/Implementation tool for PostgreSQL - EARP
15.1 What is EARP ?
15.2 Implementation
15.3 What you need to run EARP
15.4 How does it work ?
15.5 Where to get EARP ?
16. PHP Hypertext Preprocessor - Server-side html-embedded scripting language for PostgreSQL
16.1 Major Features
16.2 Credits
16.3 PHP 3 - Brief History
16.4 So, what can I do with PHP/FI ?
16.5 A simple example
16.6 CGI Redirection
16.6.1 Apache 1.0.x Notes
16.6.2 Netscape HTTPD
16.6.3 NCSA HTTPD
16.7 Running PHP/FI from the command line
17. Python Interface for PostgreSQL
17.1 Where to get PyGres ?
17.2 Information and support
18. Gateway between PostgreSQL and the WWW - WDB-P95
18.1 About wdb-p95
18.2 Does the PostgreSQL server, pgperl, and httpd have to be on the same host?
19. "C", "C++", ESQL/C language Interfaces and Bitwise Operators for PostgreSQL
19.1 "C" interface
19.2 "C++" interface
19.3 ESQL/C
19.4 BitWise Operators for PostgreSQL
20. Japanese Kanji Code for PostgreSQL
21. PostgreSQL Port to Windows 95/Windows NT
22. Mailing Lists
22.1 Get a Free e-mail account
22.2 English Mailing List
22.3 Archive of Mailing List
22.4 Spanish Mailing List
23. Documentation and Reference Books
23.1 User Guides and Manuals
23.2 Online Documentation
23.3 Useful Reference Textbooks
23.4 ANSI/ISO SQL Specifications documents - SQL 1992, SQL 1998
23.5 Syntax of ANSI/ISO SQL 1992
23.6 Syntax of ANSI/ISO SQL 1998
23.7 SQL Tutorial for beginners
23.8 Temporal Extension to SQL92
23.9 Part 0 - Acquiring ISO/ANSI SQL Documents
23.10 Part 1 - ISO/ANSI SQL Current Status
23.11 Part 2 - ISO/ANSI SQL Foundation
23.12 Part 3 - ISO/ANSI SQL Call Level Interface
23.13 Part 4 - ISO/ANSI SQL Persistent Stored Modules
23.14 Part 5 - ISO/ANSI SQL/Bindings
23.15 Part 6 - ISO/ANSI SQL XA Interface Specialization (SQL/XA)
23.16 Part 7 - ISO/ANSI SQL Temporal
23.16.1 INTRODUCTION
23.16.2 A CASE STUDY - STORING CURRENT INFORMATION
23.16.3 A CASE STUDY - STORING HISTORY INFORMATION
23.16.4 A CASE STUDY - PROJECTION
23.16.5 A CASE STUDY - JOIN
23.16.6 A CASE STUDY - AGGREGATES
23.16.7 SUMMARY
23.17 Part 8 - ISO/ANSI SQL MULTIMEDIA (SQL/MM)
24. Technical support for PostgreSQL
25. Economic and Business Aspects
26. List of Other Databases
27. Internet World Wide Web Searching Tips
28. Conclusion
29. FAQ - Questions on PostgreSQL
30. Copyright Notice
31. Appendix A - Syntax of ANSI/ISO SQL 1992
32. Appendix B - SQL Tutorial for beginners
32.1 Tutorial for PostgreSQL
32.2 Internet URL pointers
33. Appendix C - Linux Quick Install Instructions
______________________________________________________________________
1. Introduction
The purpose of this document is to provide comprehensive list of
pointers/URLs to quickly setup PostgreSQL and also to advocate the
benefits of Open Source Code system like PostgreSQL, Linux.
Each and every computer system in the world needs a database to
store/retrieve the information. The primary reason you use the
computer is to store, retrieve and process information and do all
these very quickly, thereby saving you time. At the same time, the
system must be simple, robust, fast, reliable, economical and very
easy to use. Database is the most VITAL SYSTEM as it stores mission
critical information of every company in this world. The most popular
database systems are based on the International Standard Organisation
(ISO) SQL specifications, which in turn is based on ANSI SQL
(American) standards. The most current specifications widely used in
the industry are ISO/ANSI SQL 1992. Upcoming standard is the SQL
1998/99 which is also called SQL-3 is still under development. Popular
database like Oracle, Sybase and Informix systems are based on these
standards or are trying to implement these standards.
There are more than 20 varieties of commercial/internet database
systems which are being used in the world and many more will be coming
in the near future. Without a standard like ANSI/ISO SQL, it would be
very difficult for the customer to develop a application once and run
on all the database systems. Customer wants to develop an application
ONCE using ISO SQL, ODBC, JDBC and deploy on all varieties of database
systems in the world.
The world's most popular FREE Database which implements some of the
ISO SQL, ANSI SQL/98, SQL/92 and ANSI SQL/89 RDBMS is PostgreSQL.
PostgreSQL is next generation Object relational database and the
future ANSI SQL standards like SQL 1998 (SQL-3) and beyond will
increasingly deal with Object databases and Object data types.
PostgreSQL is the only free RDBMS in the world which supports Object
databases and SQL. This document will tell you how-to install the
database, how to set up the Web database, application database, front
end GUIs and interface programs. It is strongly advised that you MUST
write your database applications 100 % compliant to standards of
ISO/ANSI SQL, ODBC, JDBC so that your application is portable across
multiple databases like PostgreSQL, Oracle, Sybase, Informix etc.
You get the highest quality, and lot many features with PostgreSQL as
it follows 'Open Source Code development model'. Open Source Code
model is the one where the complete source code is given to you and
the development takes place on the internet by a extremely vast
network of human brains. Future trend shows that most of the software
development will take place on the so called "Information Super-
Highway" which spans the whole globe. In the coming years, internet
growth will be explosive which will further fuel rapid adoption of
PostgreSQL by the database community.
By applying the principles of statistics, mathematics and science to
software quality, you get the best quality of software only in a 'Open
Source Code System' like PostgreSQL, wherein the source code is open
to a very vast number of human brains inter-connected by the
information super-highway. Greater the number of human brains
working, the better will be the quality of software. Open Source Code
model will also prevent RE-INVENTION OF WHEELS, eliminates DUPLICATION
OF WORK and will be very economical, saves time in distribution and
follows the modern economic laws of optimizing the national and global
resources. Once a software work is done by others, than you DO NOT
need to re-do that again. You will not be wasting your valuable time
on something which had already been WELL DONE. Your time is extremely
precious and it must be utilized efficiently, because you have only 8
hours per day for doing work!! As we will be entering the 21st
century, there will be a change in the way that you get software for
your use. Customers will give first preference for the open systems
software like PostgreSQL, Linux, etc...
If you buy binaries, you will not get any equity and ownership of
source code. Source code is a very valuable asset and binaries have no
value. Buying software may become a thing of the past. You only need
to buy good hardware, it is worth spending money on the hardware and
get the software from internet. Important point is that it is the
computer hardware which is doing bulk of the work. Hardware is the
real work horse and software is just driving it. Computer hardware is
so much more complex that only 6 nations out of 180 countries in the
world so far have demonstrated the capability of designing and
manufacturing computer chips/hardware. Design and manufacturing of
computer chips is a advanced technology. It is a very complex
process, capital intensive, requires large investments in plant and
production machines which deal with 0.18 micron technology. On a
single small silicon chip millions of transistors/circuits are densely
packed. Companies like Applied Material, AMD, Intel, Cyrix, Hitachi,
IBM and others spent significant number of man-years to master the
high-technology like Chip Design, Micro-electronics and Nano-
electronics. Micro means (one-millionth of meter 10^-6), Nano means
(one-billionth of meter 10^-9). Current technology uses micro-
electronics of about 0.35 micron using aluminum as conductors and 0.25
micron sizes using copper as conductors of electrons. In near future
the technology of 0.10 micron with copper and even nano-electronics
will be used to make computer chips. Aluminum conductors will be
phased out by copper on computer chips, as copper is a better
conductor of electrons. In photolithography process extreme
ultraviolet, X-ray or electron-beam techniques will be used to etch
circuits for feature size less than 0.15 micron. In about 20 years
from now, silicon chips will be phased out by molecular computers and
bio chips which will be billions of times faster than silicon chips.
Molecules are a group of atoms. And atoms are tiny particles which
makes up everything that you see in this world. Molecular computers
will use the molecules of matter as ultra-fast electronic on/off
switches. When the switch is ON it indicates 1, and when it is OFF it
indicates 0. All the computer programs in this world are based on
binary (numbers 1 and 0). Table below shows the progress and future
advancement trends of computer chips.
Advancement of chip capabilities in future
********************************************
+--------------------------+---------+---------+---------+---------+--------+---------+
| Item/Year | 1997 | 1999 | 2001 | 2003 | 2012 | 2020 |
+--------------------------+---------+---------+---------+---------+--------+---------+
| Feature size(micron) | 0.25 | 0.18 | 0.15 | 0.13 | 0.05 |< 0.00001|
+--------------------------+---------+---------+---------+---------+--------+---------+
| Wafer size(mm) | 200 | 300 | 300 | 300 | 450 | Mol/Bio |
+--------------------------+---------+---------+---------+---------+--------+---------+
| Min Operating Voltage | 1.8-2.5 | 1.5-1.8 | 1.2-1.5 | 1.2-1.5 | 0.5-0.6| < 0.001 |
+--------------------------+---------+---------+---------+---------+--------+---------+
| Max power dissipation | 70 | 90 | 110 | 130 | 175 | 600 |
+--------------------------+---------+---------+---------+---------+--------+---------+
| On-chip frequencey (MHz) | 750 | 1,250 | 1,500 | 2,100 | 10,000 | > 50,000|
+--------------------------+---------+---------+---------+---------+--------+---------+
| DRAM capacity | 256 MB | 1 GB | 2 GB | 4 GB | 256 GB | > 1000GB|
+--------------------------+---------+---------+---------+---------+--------+---------+
As you can see, it is hardware that is high technology and important
and software is a less difficult technology. Hence, manufacturing
hardware/hard-goods is vital for national economy! Companies like Com
paq, Dell, Sun Microsystems, HP, IBM who manufacture computers are
major contributors to U.S economy today and in the future!!
On other hand, each and every country in the world develops/makes
software. In fact, any person in this world with a small low-cost PC
can create a Oracle database server system. But it would take him
about 10 years (Oracle database server is about 10 man-years of work).
One man-year is one person working full-time for one full year. If 10
people work for a year than it is 10 man-years spent.
Databases like Oracle, Informix, Sybase, IBM DB2 (Unix) are written
using the "C" language and binaries are created by compiling the
source code and than they are shipped out to customers. Oracle,
Sybase, Informix databases are 100 % "C" programs!!
Since a lot of work had been done on PostgreSQL for the past 12 years,
it does not make sense to re-create from scratch another database
system which satisfies ANSI/ISO SQL. It will be a great advantage to
take the existing code and add missing features or enhancements to
PostgreSQL and start using it immediately.
PostgreSQL is not just a free database but it is a good quality
'Internet Product'. Prediction is that demand for "Made in Internet"
products will grow exponentially as it is capable of maintaining a
high quality, low cost, extremely large user-base and developer-base.
Those nations who do not use the 'Made in Internet' products will be
seriously missing "World-wide Internet Revolution" and will be left
far behind other countries. The reason is "Internet" itself is the
world's LARGEST software company!
2. Other Formats of this Document
This document is published in 10 different formats namely - DVI,
Postscript, Latex, LyX, GNU-info, HTML, RTF(Rich Text Format), Plain-
text, Unix man pages and SGML.
· You can get this HOWTO document as a single file tar ball in HTML,
DVI, Postscript or SGML formats from -
· Plain text format is in:
· Translations to other languages like French, German, Spanish,
Chinese, Japanese are in
Any help from you to
translate to other languages is welcome.
The document is written using a tool called "SGML tool" which can
be got from - Compiling the
source you will get the following commands like
· sgml2html databasehowto.sgml (to generate html file)
· sgml2rtf databasehowto.sgml (to generate RTF file)
· sgml2latex databasehowto.sgml (to generate latex file)
This document is located at -
·
Also you can find this document at the following mirrors sites -
·
·
·
·
· Other mirror sites near you (network-address-wise) can be found at
select a site and go to
directory /LDP/HOWTO/PostgreSQL-HOWTO.html
In order to view the document in dvi format, use the xdvi program. The
xdvi program is located in tetex-xdvi*.rpm package in Redhat Linux
which can be located through ControlPanel | Applications | Publishing
| TeX menu buttons.
To read dvi document give the command -
xdvi -geometry 80x90 howto.dvi
And resize the window with mouse. See man page on xdvi.
To navigate use Arrow keys, Page Up, Page Down keys, also
you can use 'f', 'd', 'u', 'c', 'l', 'r', 'p', 'n' letter
keys to move up, down, center, next page, previous page etc.
To turn off expert menu press 'x'.
You can read postscript file using the program 'gv' (ghostview) or The
ghostscript program is in ghostscript*.rpm package and gv program is
in gv*.rpm package in Redhat Linux which can be located through Con
trolPanel | Applications | Graphics menu buttons. The gv program is
much more user friendly than ghostscript. Also ghostscript and gv are
available on other platforms like OS/2, Windows 95 and NT, you view
this document even on those platforms.
To read postscript document give the command -
gv howto.ps
To use ghostscript give -
ghostscript howto.ps
CAUTION: This document is large, total number of pages (postscript) if
printed will be approximately 113 pages.
You can read HTML format document using Netscape Navigator, Microsoft
Internet explorer, Redhat Baron Web browser or any of the 10 other web
browsers.
You can read the latex, LyX output using LyX a X-Windows front end to
latex.
3. Laws of Physics applies to Software!
In this chapter, it will be shown how science plays a important role
in the creation of various objects like software, this universe, mass,
atoms, energy and even yourself! This chapter also shows why
knowledge of science is very important BEFORE you start using the
products of science. Objects include everything - for example
PostgreSQL, time, mass, energy, planets, sun, moon, stars, galaxies,
super-clusters, humans etc... are objects made by science. This
chapter also shows how laws of science and statistics favour the open-
source code system like PostgreSQL and Linux. As the internet speed
is increasing everyday, and internet is becoming more and MORE
reliable, the open-source code system will gain very rapid momentum.
And, if rules of statistics and laws of physics are correct than the
closed source-code systems will eventually VANISH from this planet.
The paragraphs given below will show you - "how vast science is, how
important it is for man and how it impacts software projects like
PostgreSQL, Linux".
Developing a project like PostgreSQL requires resources like energy
and time, hence PostgreSQL is a product of energy and time. Since
energy and time can be explained only by science, there is a direct
co-relation between physics and software projects like PostgreSQL,
Linux.
Laws of science (Physics) applies everywhere and at all the times, to
anything that you do, even while you are developing the software
projects. Physics is in action even while you are talking (sound
waves), walking (friction between ground and your feet), reading a
book or writing software. Various branches of sciences like physics,
chemistry etc all merge into one grand region called Mathematics
(which is also known as the Queen of all Sciences). Everything in
this world has a deep root in mathematics, including PostgreSQL.
PostgreSQL uses 'Modern Algebra' which is a tiny branch of
mathematics. Modern algebra deals with 'Set Theory', 'Relational
Algebra', science of Groups, Rings, Collections, Sets, Unions,
Intersections, Exclusions, Domains, Lists, etc...
The software like PostgreSQL is existing today because of the energy
and time. It is the energy which made this world, human brains and
many other things! And mass and energy are ONE and the SAME entity!
The fact that mass and energy are same was unknown to people 100 years
ago!
Cells in the human brains consume energy while processing (creating
software), by converting the chemical energy from food into electrical
and heat energy. Even while you are reading this paragraph, the cells
in your brain are burning out the fuel and are using tiny amounts of
energy. So STOP READING NOW ! The energy activity of neurons (brain
cells) can be measured in the laboratory. For example, there are many
instruments like 'Lie Detectors' and other medical instruments which
can measure the energy activities of brain. All of these implies that
human brain is a thermodynamic heat engine. Because human brain is a
thermodynamic engine, the laws of thermodynamics applies to brain and
hence thermodynamics has indirect effects on software like PostgreSQL.
As per science, it is impossible to build any system or theory
(including a database software system) which will be 100 % perfect and
bug free. It is like chasing a mirage, we will NEVER reach the goal
of perfect system or theory. Detailed mathematical
equations/discussions to prove that 'perfect system' (as well as
'imperfect system') is impossible, is a advanced topic and is beyond
the scope of this document. And such a mathematical discussion deals
with infinite number of dimensions (as well as primary dimensions)
which are existing in nature. Unfortunately humans can see or feel
only 4 dimensions but mathematics can easily explore many other
dimensions. Other dimensions are 'infinitely smaller' than the atoms
and atoms themselves are very minute which human eyes cannot see them!
Mathematics is very powerful as it can analyze and explain the
birth/death of our universe. Our universe is almost zero size if you
look from other universe and vice versa. That is, our universe is not
visible (does not exist) for persons in other universe! And vice
versa!! Theoretically, you can exit out of our universe and travel
vast distances (billions of light years) in zero time and re-enter
universe at a different point of space-time! Distance between our
universe and other universes is actually zero!
Even though there are infinite number of dimensions, they all can be
derived/generated from a small number of PRIMARY dimensions. That is,
infinite number of dimensions can combine and collapse into primary
dimensions. Primary dimensions simply absorb other dimensions without
themselves getting destroyed. Mathematicians use these primary
dimensions to understand the birth and death of universes. The
universe where you are currently living started with a BIG BANG
billions of years ago (roughly 20 billion years ago) which was caused
by the interactions of atomic particles of other dimensions. Just
before the big bang there was a tiny point where length, breadth,
height and time was ZERO (that is, our universe was NOT THERE!!) and
other universes and primary dimensions were existing. Time itself was
NOT there and atoms, stars, planets, galaxies were NOT there! The
atoms inside your body were NOT there!! So many things happened even
BEFORE the time was born!
Big bang and hence birth of our universe was caused by few atoms of
primary dimensions. SOMEONE (something?) caused the dashing of few
tiny atoms of other dimensions to create our universe, and new
dimensions time, length, breadth, height was born! We see someone's
hand in this process. That process is not very well understood by
man. Man is trying to generate another universe in the lab by
simulating the big bang event (Huge accelerator is under construction
in Europe, another construction in Dallas, USA was stopped by US
congress due to budget cuts). There are atoms of other dimensions just
as we have atoms in our universe. Theoretically, you can
create/generate infinite number of universes! This process is
reversible, that is our universe can completely close down and vanish
into few atoms of other dimensions! It is similar in anology as to how
YOU were born from two tiny cells which DASHED against each other to
create one single cell. That single tiny cell divided and multiplied
into 6 trillion cells to become a 6 foot tall human (that is you!).
There are some similarities between humans and universes, universes
are born and later die, very much similar to humans.
Since PERFECT state (as well as IMPERFECT state) is impossible,
universes like ours are born and later die down in a cyclic process.
BUT there can NO PERFECT death, only transformation is permitted by
science! Our universe is currently expanding at a tremendous rate, it
is not static but is very dynamic. This universe will keep expanding
untill something interferes to collapse this universe by applying
pressures with external dimensions to aborb and annihilate our
universe!! Two possibilities are - removing the mass from our universe
via black holes (a slow process), or injecting more mass into our
universe via white holes (a rapid big crunch process). There can be
millions of universes in existence but there can be very few universes
which are built from primary dimensions. You are not only made up of
atoms of this universe but also by atoms of other dimensions! In
black holes the atoms and particles from our universe get sucked into
and are completely transformed and converted to particles of other
dimensions! In the center of black hole time is zero and length,
breadth, height is zero! And black hole is EXIT/ENTRY door to and from
other universes. Entry/Exit doors to other universes can open up
anywhere, even inside your body!
There can be infinite number of colors, computer langauages, computer
chip designs and theories but there CANNOT be ONE SINGLE PERFECT
color, computer language, design or system! What you can have is only
a NEAR PERFECT color(wavelength), system, database, or theory!
Nature is like a Kaliedoscope.
By combining the energies of millions of people around the world via
internet it is possible to achieve a NEAR PERFECT system (including a
database software system). Individually, the energy of each person
will be minute, but by networking a large number of people, the total
energy will be huge which can be focused on a project to generate a
near perfect system. Human beings are creatures of finite energy and
resources, frequently guilty of errors ranging from the trivial to the
profound. Because of our propensity for error varies broadly with
particular skills, particular experience and the vagaries of the
moment, the discovery and elimination of software bugs produced by
ordinary human error can be greatly facilitated by bringing a great
many minds to bear on the problem. In addition, more individuals
represent extra person hours of code and its asocciated function.
It is very clear that internet can network a vast number of people,
which implies internet has a lot of energy and time which can produce
much higher quality software products in much shorter time as compared
to commercial companies. Even big companies like Microsoft, IBM cannot
overpower and overrule the laws of Physics but will eventually
SURRENDER UNTO laws of science!
Today, there are too many SQL RDBMS databases in the world aiming at
only one specification ANSI/ISO SQL. Man must not waste his time
creating too many SIMILAR/IDENTICAL software packages and there are
many other topics in science which need good attention.
Conclusion is - because of laws of science, 'open source code' system
like PostgreSQL, Linux will be always much better than 'closed source
code' system and it is possible to prove this statement
scientifically.
4. What is PostgreSQL ?
PostgreSQL Version 6.4 is a free database, complete source code is
given to you and is a Object-Relational Database System near compliant
(getting closer) with ANSI SQL1998,92,89 and runs on diverse hardware
platforms and Operating systems.
Sometimes emergency bug fix patches are released after the
GA release of PostgreSQL. You can apply these optional patches
depending upon the needs of your application. Follow these
steps to apply the patches -
Change directory to postgresql source directory
cd /usr/src/postgresql6.4
patch -p0 < patchfile
make clean
make
See also manual page do 'man patch'
The patch files are located in
· PostgreSQL patches :
The ultimate objective and the final goal of PostgreSQL is to become
100 % compliant to ANSI/ISO SQL and also to become the number ONE open
generic Database in the world. PostgreSQL will also guide, steer,
control, monitor and dictate the future of ANSI/ISO SQL. That is, the
implementation and ideas first take place in PostgreSQL and than later
be incorporated into the ANSI/ISO SQL.
Informix Universal server (released 1997) is based on earlier version
of PostgreSQL because Informix bought Illustra Inc. and integrated
with Informix. Illustra database was completely based on Postgres
(earlier version of PostgreSQL).
PostgreSQL is an enhancement of the POSTGRES database management
system, a next-generation DBMS research prototype. While PostgreSQL
retains the powerful data model and rich data types of POSTGRES, it
replaces the PostQuel query language with an extended subset of SQL.
PostgreSQL development is being performed by a team of Internet
developers who all subscribe to the PostgreSQL development mailing
list. The current coordinator is Marc G. Fournier
· scrappy@postgreSQL.org
This team is now responsible for all current and future development
of PostgreSQL. Ofcourse, the database customer himself is the
developer of PostgreSQL! The development load is distributed among
a very large number of database end-users on internet.
The authors of PostgreSQL 1.01 were Andrew Yu and Jolly Chen. Many
others have contributed to the porting, testing, debugging and
enhancement of the code. The original Postgres code, from which
PostgreSQL is derived, was the effort of many graduate students,
undergraduate students, and staff programmers working under the
direction of Professor Michael Stonebraker at the University of
California, Berkeley.
The original name of the software at Berkeley was Postgres. When SQL
functionality was added in 1995, its name was changed to Postgres95.
The name was changed at the end of 1996 to PostgreSQL.
Millions of PostgreSQL is installed as Database servers, Web database
servers and Application data servers. It is much more advanced and is
a object oriented relational database (ORDBMS).
PostgreSQL can store more data types than traditional datatypes like
integer, characters, etc. - you get to create user-defined types,
functions, inheritance etc. PostgreSQL runs on Solaris, SunOS, HPUX,
AIX, Linux, Irix, Digital Unix, BSDi,NetBSD, FreeBSD, SCO unix,
NEXTSTEP, Unixware and all and every flavor of Unix. Port to Windows
95/NT is underway.
· Title: PostgreSQL SQL RDBMS Database (Object Relational
Database Management System)
· Current Version: 6.4
· Age: PostgreSQL is 12 years old. Developed since 1985
· Authors: Developed by millions/universities/companies on
internet for the past 12 YEARS
PostgreSQL and related items in this document are subject to the
following COPYRIGHT.
PostgreSQL Data Base Management System
Copyright (c) 1994-6 Regents of the University of California
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose, without fee, and without a written agreement
is hereby granted, provided that the above copyright notice and this
paragraph and the following two paragraphs appear in all copies.
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
5. Where to get it ?
You can buy Redhat Linux CDROM, Debian Linux CDROM or Slackware Linux
CDROM which already contains the Postgresql in package form (both
source code and binaries) from :
· Linux System Labs Web site: 7 (U.S.
dollars)
· Cheap Bytes Inc Web site: 7 (U.S.
dollars)
· Debian Main Web site :
PostgreSQL organisation is also selling 'PostgreSQL CDROM' which
contains the complete source code and binaries for many Unix operating
systems as well as full documentation.
· PostgreSQL CDROM from main Web site at :
30 (U.S. dollars)
Binaries only distribution of PostgreSQL:
· You can run PostgreSQL without compiling the source. Get binaries
for Intel-Linux from file
is postgresql-6.4.i386.rpm. This is in the redhat package 'rpm'
format and it contains both source and binaries for PostgreSQL.
· Binaries site for Solaris, HPUX, AIX, IRIX, Linux :
If you compile on any
platform please upload to site, so that it will be useful for
others.
· ftp site : Get binaries for Intel-Linux from
file is
postgresql-6.4.i386.rpm. This is in the redhat package 'rpm' format
and it contains both source and binaries for PostgreSQL.
WWW Web sites:
· Primary Web site:
· Secondary Web site:
·
·
·
·
The ftp sites are listed below :-
· Primary FTP:
· Secondary FTP:
·
·
·
·
·
·
·
·
·
·
PostgreSQL source code is also available at all the mirror sites of
sunsite unc (total of about 1000 sites around the globe). It is inside
the Red Hat Linux distribution in /pub/contrib/i386/postgresql.rpm
file.
· For list of mirror sites go to
6. PostgreSQL Supports Extremely Large Databases greater than 200 Gig
Performance of 32-bit cpu machines will decline rapidly when the
database size exceeds 5 GigaByte. You can run 30 gig database on
32-bit cpu but the performance will be degraded. Machines with 32-bit
cpu imposes a limitation of 2 GB on RAM, 2 GB on file system sizes and
other limitations on the operating system.
For extremely large databases, it is strongly advised to use 64-bit
machines like Digital Alpha cpu, Sun Ultra-sparc 64-bit cpu, Silicon
graphics 64-bit cpu, Intel Merced IA-64 cpu, HPUX 64bit machines or
IBM 64-bit machines. Compile PostgreSQL under 64-bit cpu and it can
support huge databases and large queries. Performance of PostgreSQL
for queries on large tables and databases will be several times faster
than PostgreSQL on 32-bit cpu machines. Advantage of 64-bit machines
are that you get very large memory addressing space and the operating
system can support very large file-systems, provide better performance
with large databases, support much larger memory (RAM), have more
capabilities etc..
7. How can I trust PostgreSQL ? Regression Test Package builds cus
tomer confidence
To validate PostgreSQL, regression test package (src/test/regress) is
included in the distribution. Regression test package will verify the
standard SQL operations as well as the extensibility capabilities of
PostgreSQL. The test package already contains hundreds of SQL test
programs.
You should use the computer's high-speed power to validate the
PostgreSQL, instead of using human brain power. Computers can carry
out software regression tests millions or even billions of times
faster than humans can. Modern computers can run billions of SQL
tests in a very short time. In the near future the speed of computer
will be several zillion times faster than human brain! Hence, it
makes sense to use the power of computer to validate the software.
You can add more tests just in case you need to, and can upload to the
primary PostgreSQL web site if you feel that it will be useful to
others on internet. Regression test package helps build customer
confidence and trust in PostgreSQL and facilitates rapid deployment of
PostgreSQL on production systems.
Regression test package can be taken as a "VERY SOLID" technical
document mutually agreed upon between the developers and end-users.
PostgreSQL developers extensively use the regression test package
during development period and also before releasing the software to
public to ensure good quality.
Capablilities of PostgreSQL are directly reflected by the regression
test package. If a functionality, syntax or feature exists in the
regression package than it is supported, and all others which are NOT
listed in the package MAY not be supported by PostgreSQL!! You may
need to verify those and add it to regression package.
8. GUI FrontEnd Tool for PostgreSQL (Graphical User Interface)
PostgreSQL has Tcl/Tk interface library in the distribution called
'pgTcl'. Tcl/Tk is a Rapid Application Development tool and is a
scripting language. Using Tcl/TK, you can develop applications once
and run it everywhere on NT, Win 95, Linux, Apple Macintosh iMac, OS/2
and all unixes. Tcl stands for 'Tool Command Language' and Tk is
'Tool Kit'. There is a IDE (integrated development environment) for
Tcl/Tk called SpecTcl. Check for this rpm package under Redhat linux
distribution or at the sunscript site given below.
Perl is strongly recommended as a scripting language, since it is the
most widely used and very powerful and is available on every hardware
and OS platforms. Perl-Tk or Perl-Qt or C++ QtEZ or C++ Lesstiff is
strongly recommended. A combination of Perl, C and Tk will satisfy
the needs of most projects, considering the time resources, speed of
executable and ease of programming. Note that Java programs run very
slow. Even C++ programs run slower than C programs. The C programs run
the fastest as compared to other languages. Perl programs can be
converted to "C" program using Perl2C program and than compiled which
will run fast.
Perl is used for programming 90 % of internet scripts in the world.
So you will have only one language ("Perl") for all your needs - in
applications as well as internet. See Perl Database Interface of this
document at ``''
You should ponder over the strong points of Perl vis-a-vis Tcl/Tk
before starting any project on Tcl. Tcl/TK is usually shipped with
every linux cdrom. Also you can get it from these sites -
· Tcl/Tk
· Object oriented extension of Tcl called INCR at
· Visual TCL site
· Visual TCL Redhat rpm at
·
·
·
· Reference text book: Many textbooks on TCL/TK are available in the
market.
9. Integrated Development Environment Tools for PostgreSQL (GUI IDE)
Check out the following development tools which you can use in
conjunction with ODBC/JDBC drivers. These are similar to Borland C++
Builder, Borland JBuilder.
Vibe is a Java and C++ IDE (Integrated Development Environment) that
won Unix Review's IDE of the year.
· More information on Vibe is at
· You can also use Borland C++ Builder, Delphi, Borland JBuilder,
PowerBuilder on Windows95 connecting to PostgreSQL on unix box
through ODBC/JDBC drivers.
See also PERL Database Interface of this document at ``'' Perl and
C/C++ is strongly recommended as the choice of langauge for IDE.
Free of cost IDE Tools -
Check the CDROM of redhat linux distribution.
· Lesstiff Motif tool
· FreeBuilder
· SpecTCL
· JccWarrior
· Kanchenjunga Java RAD Tool for PostgreSQL
· Applixware Tool
· XWPE X Windows Programming Environment
· XWB X Windows Work Bench
· NEdit
10. Interface Drivers for PostgreSQL
10.1. ODBC Drivers for PostgreSQL
ODBC stands for 'Open DataBase Connectivity' is a popular standard for
accessing information from various databases from different vendors.
Applications written using the ODBC drivers are guaranteed to work
with various databases like PostgreSQL, Oracle, Sybase, Informix etc..
· PostODBC is already included in the distribution. See main web site
. It is included on the PostgreSQL
CDROM.
· Open Link Software Corporation is
selling ODBC for PostgreSQL and other databases. Open Link also is
giving away free ODBC (limited seats) check them out.
· Insight ODBC for PostgreSQL
This is the official PostODBC site.
There is a project called the FreeODBC Pack Package . There's no
PostgreSQL Version there, maybe you can help.
· This is a free of cost
version of ODBC.
10.2. UDBC Drivers for PostgreSQL
UDBC is a static version of ODBC independent of driver managers and
DLL support, used to embed database connectivity support directly into
applications.
· Open Link Software Corporation is
selling UDBC for PostgreSQL and other databases. Open Link also is
giving away free UDBC (limited seats) check them out.
10.3. JDBC Drivers for PostgreSQL
JDBC stands for 'Java DataBase Connectivity'. Java is a platform
independent programming language developed by Sun Microsystems. Java
programmers are encouraged to write database applications using the
JDBC to facilitate portability across databases like PostgreSQL,
Oracle, informix, etc. If you write Java applications you can get JDBC
drivers for PostgreSQL from the following sites:
JDBC driver is already included in the PostgreSQL distribution.
· Sun's Java
connectivity to PostgreSQL
·
· Open Link Software Corporation is
selling JDBC for PostgreSQL and other databases. Open Link also is
giving away free JDBC (limited seats) check them out.
· JDBC UK site
· JDBC FAQ site
The JDBC home, guide and FAQ are located at -
· JDBC HOME
· JDBC guide
· JDBC FAQ
10.4. Java for PostgreSQL
Java programmers can find these for PostgreSQL very useful.
· and see postgresql-
jdbc-*.rpm
·
11. Perl Database Interface (DBI) Driver for PostgreSQL
11.1. Perl 5 interface for PostgreSQL
PERL is an acronym for 'Practical Extraction and Report Language'.
Perl is available on each and every operating system and hardware
platform in the world. You can use Perl on Windows95/NT, Apple
Macintosh iMac, all flavors of Unix (Solaris, HPUX, AIX, Linux, Irix,
SCO etc..), mainframe MVS, desktop OS/2, OS/400, Amdahl UTS and many
others. Perl runs EVEN on many unpopular or generally-unknown
operating systems and hardware!! So do not be surprised if you see
perl running on a very rarely used operating system. You can imagine
the vast extent of the user base and developer base of Perl.
Perl interface for PostgreSQL is included in the distribution of
PostgreSQL. Check in src/pgsql_perl5 directory.
· Pgsql_perl5 contact Email: E.Mergl@bawue.de
· Another source from -
· Perl Home page :
· Perl tutorial, look for Tutorial title at :
· Perl FAQ is at :
· Perl GUI User Interfaces Perl-Qt rpm :
and look for
PerlQt-1.06-1.i386.rpm
· Perl GUI User Interfaces Perl-Qt :
· Perl GUI User Interfaces Perl-XForms :
and look for
Xforms4Perl-0.8.4-1.i386.rpm
· Perl GUI User Interfaces Perl-Tk :
· Perl GUIkits :
· Perl Database Interfaces :
· Perl to "C" translator : and look for Compiler-a3.tar.gz
· Bourne shell to Perl translator :
· awk to Perl a2p and sed to Perl s2p is included with the PERl
distribution.
· See also the newsgroups for PERL at comp.lang.perl.*
11.2. Perl Database Interface DBI
11.2.1. WHAT IS DBI ?
The Perl Database Interface (DBI) is a database access Application
Programming Interface (API) for the Perl Language. The Perl DBI API
specification defines a set of functions, variables and conventions
that provide a consistent database interface independent of the actual
database being used. The information for this DBI section is obtained
from 'DBI FAQ' doc whose author is Alligator Descartes and reproduced
here with his permission.
· Alligator Descartes Hermetica is at descarte@hermetica.com
11.2.2. DBI driver for PostgreSQL DBD-Pg-0.89
Get DBD-Pg-0.89.tar.gz from below
· DBD-Pg-0.89 :
· Comprehensive Perl Archive Network CPAN
· DBI drivers list and DBI module pages
· DBI information is at
· Primary ftp site
· Miscellaneous DBI link
· Miscellaneous DBI link
· Miscellaneous DBI link
· PostgreSQL database
REQUIREMENTS:
· - build, test and install Perl 5 (at least 5.002)
· - build, test and install the DBI module (at least 0.89)
· - build, test and install PostgreSQL (at least 6.2)
11.2.3. Technical support for DBI
Please send comments and bug-reports to
· E.Mergl@bawue.de
Please include the output of perl -v, and perl -V, the version of
PostgreSQL, the version of DBD-Pg, and the version of DBI in your bug-
report.
11.2.4. What is DBI, DBperl, Oraperl and *perl?
To quote Tim Bunce, the architect and author of DBI:
``DBI is a database access Application Programming Interface (API) for
the Perl Language. The DBI API Specification defines a set of
functions, variables and conventions that provide a consistent
database interface independent of the actual database being used.''
In simple language, the DBI interface allows users to access multiple
database types transparently. So, if you connecting to an Oracle,
Informix, mSQL, Sybase or whatever database, you don't need to know
the underlying mechanics of the 3GL layer. The API defined by DBI will
work on all these database types.
A similar benefit is gained by the ability to connect to two different
databases of different vendor within the one perl script, ie, I want
to read data from an Oracle database and insert it back into an
Informix database all within one program. The DBI layer allows you to
do this simply and powerfully.
DBperl is the old name for the interface specification. It's usually
now used to denote perl4 modules on database interfacing, such as,
oraperl, isqlperl, ingperl and so on. These interfaces didn't have a
standard API and are generally not supported.
Here's a list of DBperl modules, their corresponding DBI counterparts
and support information. DBI driver queries should be directed to the
dbi-users mailing list.
Module Name Database Required Author DBI
----------- ----------------- ------ ---
Sybperl Sybase Michael Peppler DBD::Sybase
http://www.mbay.net/~mpeppler
Oraperl Oracle 6 & 7 Kevin Stock DBD::Oracle
Ingperl Ingres Tim Bunce & DBD::Ingres
Ted Lemon
Interperl Interbase Buzz Moschetti DBD::Interbase
Uniperl Unify 5.0 Rick Wargo None
Pgperl Postgres Igor Metz DBD::Pg
Btreeperl NDBM John Conover SDBM?
Ctreeperl C-Tree John Conover None
Cisamperl Informix C-ISAM Mathias Koerber None
Duaperl X.500 Directory Eric Douglas None
User Agent
However, some DBI modules have DBperl emulation layers, so, DBD::Ora
cle comes with an Oraperl emulation layer, which allows you to run
legacy oraperl scripts without modification. The emulation layer
translates the oraperl API calls into DBI calls and executes them
through the DBI switch.
Here's a table of emulation layer information:
Module Emulation Layer Status
------ --------------- ------
DBD::Oracle Oraperl Complete
DBD::Informix Isqlperl Under development
DBD::Sybase Sybperl Working? ( Needs verification )
DBD::mSQL Msqlperl Experimentally released with
DBD::mSQL-0.61
The Msqlperl emulation is a special case. Msqlperl is a perl5 driver
for mSQL databases, but does not conform to the DBI Specification.
It's use is being deprecated in favour of DBD::mSQL. Msqlperl may be
downloaded from CPAN via:
·
11.2.5. DBI specifications
There are a few information sources on DBI.
· DBI Specification
There are two specifications available at this link, the new DBI
Draft Specification which is a rapidly changing document as the
development team drive towards a stable interface, and the old
historical DBperl Specification out of which the current DBI
interface evolved.
The later document should be regarded as being of historical interest
only and should not serve as a programming manual, or authoratative in
any sense. However, it is still a very useful reference source.
POD documentation PODs are chunks of documentation usually embedded
within perl programs that document the code ``in place'', providing a
useful resource for programmers and users of modules. POD for DBI and
drivers is beginning to become more commonplace, and documentation for
these modules can be read with the following commands.
The DBI Specification The POD for the DBI Specification can be read
with the command
perldoc DBI
Oraperl Users of the Oraperl emulation layer bundled with DBD::Oracle,
may read up on how to program with the Oraperl interface by typing:
perldoc Oraperl
This will produce an updated copy of the original oraperl man page
written by Kevin Stock for perl4. The oraperl API is fully listed and
described there.
DBD::mSQL Users of the DBD::mSQL module may read about some of the
private functions and quirks of that driver by typing:
perldoc DBD::mSQL
Frequently Asked Questions The Frequently Asked Questions is also
available as POD documentation. Read this by typing:
perldoc DBI::FAQ
This may be more convenient to people not permanently, or
conveniently, connected to the Internet.
POD in general Information on writing POD, and on the philosophy of
POD in general, can be read by typing:
perldoc perlpod
Users with the Tk module installed may be interested to learn there is
a Tk-based POD reader available called tkpod, which formats POD in a
convenient and readable way.
Rambles, Tidbits and Observations : There are a series of occasional
rambles from various people on the DBI mailing lists.
·
``DBI -- The perl5 Database Interface'' This is an article written by
Alligator Descartes and Tim Bunce on the structure of DBI. It was
published in issue 5 of ``The Perl Journal''. It's extremely good. Go
buy the magazine. In fact, buy all of them. ``The Perl Journal''s WWW
site is:
·
``DBperl'' This article, published in the November 1996 edition of
``Dr. Dobbs Journal'' concerned DBperl.
``The Perl5 Database Interface'' This item is a book to be written by
Alligator Descartes and published by O'Reilly and Associates.
Mailing Lists There are three mailing lists for DBI run by Ted Lemon.
These can all be subscribed to and unsubscribed from via the World
Wide Web at
· Mailing lists
The lists that users may participate in are:
dbi-announce This mailing list is for announcements only. If you
cannot successfully use the form on the above WWW page, please
subscribe to the list in the following manner:
· Email: dbi-announce-request@fugue.com with a message body of
'subscribe'
dbi-dev This mailing list is intended for the use of developers
discussing ideas and concepts for the DBI interface, API and driver
mechanics. Only any use for developers, or interested parties. If you
cannot successfully use the form on the above WWW page, please
subscribe to the list in the following manner:
· Email: dbi-dev-request@fugue.com with a message body of 'subscribe'
dbi-users This mailing list is a general discussion list used for bug
reporting, problem discussion and general enquiries. If you cannot
successfully use the form on the above WWW page, please subscribe to
the list in the following manner:
· Email: dbi-users-request@fugue.com with a message body of
'subscribe'
Mailing List Archives
· US Mailing List Archives
· European Mailing List Archives
11.2.6. Compilation problems or "It fails the test"
If you have a core dump, try the Devel::CoreStack module for
generating a stack trace from the core dump. Devel::CoreStack can be
found on CPAN at:
·
Email the dbi-users Mailing List stack trace, module versions, perl
version, test cases, operating system versions and any other pertinent
information. The more information you send, the quicker developers
can track problems down. If you send us nothing, expect nothing back.
11.2.7. Is DBI supported under Windows 95 / NT platforms?
The DBI and DBD::Oracle Win32 ports are now a standard part of DBI,
so, downloading DBI of version higher than 0.81 should work fine. You
can access Microsoft Access and SQL-Server databases from DBI via
ODBC. Supplied with DBI-0.79 (and later) is an experimental DBI
'emulation layer' for the Win32::ODBC module. It's called
DBI::W32ODBC. You will need the Win32::ODBC module.
· Win32 DBI
· Win32 ODBC
11.2.8. What's DBM? And why use DBI instead ?
UNIX was originally blessed with simple file-based ``databases'',
namely the dbm system. dbm lets you store data in files, and retrieve
that data quickly. However, it also has serious drawbacks.
File Locking
The dbm systems did not allow particularly robust file locking
capabilities, nor any capability for correcting problems arising
through simultaneous writes [ to the database ].
Arbitrary Data Structures
The dbm systems only allows a single fixed data structure: key-value
pairs. That value could be a complex object, such as a [ C ] struct,
but the key had to be unique. This was a large limitation on the
usefulness of dbm systems.
However, dbm systems still provide a useful function for users with
simple datasets and limited resources, since they are fast, robust and
extremely well-tested. Perl modules to access dbm systems have now
been integrated into the core Perl distribution via the AnyDBM_File
module.
To sum up, DBM is a perfectly satisfactory solution for essentially
read-only databases, or small and simple datasets. However, for more
powerful and scaleable datasets, not to mention robust transactional
locking, users are recommended to use DBI.
11.2.9. Is < insert feature here > supported in DBI?
Given that we're making the assumption that the feature you have
requested is a non-standard database-specific feature, then the answer
will be no.
DBI reflects a generic API that will work for most databases, and has
no database-specific functionality.
However, driver authors may, if they so desire, include hooks to
database-specific functionality through the func method defined in the
DBI API. Script developers should note that use of functionality
provided via the func methods is unlikely to be portable across
databases.
11.2.10. Is DBI any use for CGI programming?
In a word, yes! DBI is hugely useful for CGI programming! In fact, CGI
programming is one of two top uses for DBI.
DBI confers the ability to CGI programmers to power WWW-fronted
databases to their users, which provides users with vast quantities of
ordered data to play with. DBI also provides the possibility that, if
a site is receiving far too much traffic than their database server
can cope with, they can upgrade the database server behind the scenes
with no alterations to the CGI scripts.
11.2.11. How do I get faster connection times with DBD Oracle and
CGI?
The Apache httpd maintains a pool of httpd children to service client
requests. Using the Apache mod_perl module by Doug MacEachern, the
perl interpreter is embedded with the httpd children. The CGI, DBI,
and your other favorite modules can be loaded at the startup of each
child. These modules will not be reloaded unless changed on disk. For
more information on Apache, see the Apache Project's WWW site:
· Apache Project WWW site
· Mod_perl module
11.2.12. How do I get persistent connections with DBI and CGI?
Using Edmund Mergl's Apache::DBI module, database logins are stored in
a hash with each of these httpd child. If your application is based on
a single database user, this connection can be started with each
child. Currently, database connections cannot be shared between httpd
children. Apache::DBI can be downloaded from CPAN via:
·
11.2.13. ``When I run a perl script from the command line, it works,
but, when I run it under the httpd, it fails!'' Why?
Basically, a good chance this is occurring is due to the fact that the
user that you ran it from the command line as has a correctly
configured set of environment variables, in the case of DBD::Oracle,
variables like $ORACLE_HOME, $ORACLE_SID or TWO_TASK. The httpd
process usually runs under the user id of nobody, which implies there
is no configured environment. Any scripts attempting to execute in
this situation will correctly fail. To solve this problem, set the
environment for your database in a BEGIN ( ) block at the top of your
script. This will solve the problem. Similarly, you should check your
httpd error logfile for any clues, as well as the ``Idiot's Guide To
Solving Perl / CGI Problems'' and ``Perl CGI Programming FAQ'' for
further information. It is unlikely the problem is DBI-related. Read
BOTH these documents carefully!
· Idiot's Guide to Solving Perl / CGI problems
11.2.14. Can I do multi-threading with DBI?
As of the current date, no. Perl does not support multi-threading.
However, multi-threading is expected to become part of the perl core
distribution as of version 5.005, which implies that DBI may support
multi-threading fairly soon afterwards. For some OCI example code for
Oracle that has multi-threaded SELECT statements, see:
·
11.2.15. How can I invoke stored procedures with DBI?
Assuming that you have created a stored procedure within the target
database, eg, an Oracle database, you can use $dbh->do to immediately
execute the procedure. For example,
$dbh->do( "BEGIN someProcedure END" );
11.2.16. How can I get return values from stored procedures with DBI?
Remember to perform error checking, though!
$sth = $dbh->prepare( "BEGIN foo(:1, :2, :3); END;" );
$sth->bind_param(1, $a);
$sth->bind_param_inout(2, \$path, 2000);
$sth->bind_param_inout(3, \$success, 2000);
$sth->execute;
11.2.17. How can I create or drop a database with DBI?
Database creation and deletion are concepts that are entirely too
abstract to be adequately supported by DBI. For example, Oracle does
not support the concept of dropping a database at all! Also, in
Oracle, the database server essentially is the database, whereas in
mSQL, the server process runs happily without any databases created in
it. The problem is too disparate to attack. Some drivers, therefore,
support database creation and deletion through the private func
methods. You should check the documentation for the drivers you are
using to see if they support this mechanism.
11.2.18. How are NULL values handled by DBI?
NULL values in DBI are specified to be treated as the value undef.
NULLs can be inserted into databases as NULL, for example:
$rv = $dbh->do( "INSERT INTO table VALUES( NULL )" );
but when queried back, the NULLs should be tested against undef. This
is standard across all drivers.
11.2.19. What are these func methods all about?
The func method is defined within DBI as being an entry point for
database-specific functionality, eg, the ability to create or drop
databases. Invoking these driver-specific methods is simple, for
example, to invoke a createDatabase method that has one argument, we
would write:
$rv = $dbh->func( 'argument', 'createDatabase' );
Software developers should note that the func methods are non-portable
between databases.
11.2.20. Commercial Support and Training
The Perl5 Database Interface is FREE software. IT COMES WITHOUT
WARRANTY OF ANY KIND. However, some organizations are providing
either technical support or training programs on DBI.
PERL CLINIC : The Perl Clinic can arrange commercial support contracts
for Perl, DBI, DBD::Oracle and Oraperl. Support is provided by the
company with whom Tim Bunce, author of DBI, works. For more
information on their services, please see :
·
12. PostgreSQL Management Tools
12.1. PGACCESS - A GUI Tool for PostgreSQL Management
PgAccess is a Tcl/Tk interface to PostgreSQL. It is already included
in the distribution of PostgreSQL. You may want to check out this web
site for a newer copy
·
· If you have any comment, suggestion for improvements, please feel
free to e-mail to : teo@flex.ro
Features of PgAccess
PgAccess windows - Main window, Table builder, Table(query) view,
Visual query builder.
Tables
· opening tables for viewing, max 200 records (changed by preferences
menu)
· column resizing, dragging the vertical grid line (better in table
space rather than in the table header)
· text wrap in cells - layout saved for every table
· import/export to external files (SDF,CSV)
· filter capabilities (enter filter like (price>3.14)
· sort order capabilities (enter manually the sort field(s))
· editing in place
· improved table generator assistant
· improved field editing
Queries
· define , edit and stores "user defined queries"
· store queries as views
· execution of queries
· viewing of select type queries result
· query deleting and renaming
· Visual query builder with drag & drop capabilities. For any of you
who had installed the Tcl/Tk plugin for Netscape Navigator, you can
see it at work clicking here
Sequences
· defines sequences, delete them and inspect them Functions
· define, inspect and delete functions in SQL language
Future implementation will have
· table design (add new fields, renaming, etc.)
· function definition
· report generator
· basic scripting
If you have any comment, suggestion for improvements e-mail to :
· teo@flex.ro
Information about libgtcl
You will need the PostgreSQL to Tcl interface library libgtcl, lined
as a Tcl/Tk 'load'-able module. The libpgtcl and the source is located
in the PostgreSQL directory /src/interfaces/libpgtcl. Specifically,
you will need a libpgtcl library that is 'load'-able from Tcl/Tk. This
is technically different from an ordinary PostgreSQL loadable object
file, because libpgtcl is a collection of object files. Under Linux,
this is called libpgtcl.so. You can download from the above site a
version already compiled for Linux i386 systems. Just copy libpgtcl.so
into your system library director (/usr/lib). One of the solutions is
to remove from the source the line containing load libpgtcl.so and to
load pgaccess.tcl not with wish, but with pgwish (or wishpg) that wish
that was linked with libpgtcl library.
12.2. Windows Interactive Query Tool for PostgreSQL (WISQL or MPSQL)
MPSQL provides users with a graphical SQL interface to PostgresSQL.
MPSQL is similar to Oracle's SQL Worksheet and Microsoft SQL Server's
query tool WISQL. It has nice GUI and has history of commands. Also
you can cut and paste and it has other nice features to improve your
productivity.
·
· Email: keidav@whidbey.com
· in file tcl_syb/wisql.html
·
· Email: de@ucolick.org
12.3. Interactive Query Tool (ISQL) for PostgreSQL called PSQL
ISQL is For Character command line terminals. This is included in the
distribution, and is called PSQL. Very similar to Sybase ISQL, Oracle
SQLplus. At unix prompt give command 'psql' which will put you in
psql> prompt.
Type \h to see help of commands.
Very user friendly and easy to use. Can also be accessed from shell
scripts.
12.4. MPMGR - A Database Management Tool for PostgresSQL
MPMGR will provide a graphical management interface for PostgresSQL.
You can find it at
·
· Email: keidav@mutinybaysoftware.com
·
· Email: keidav@whidbey.com
· in file tcl_syb/wisql.html
· WISQL for PostgreSQL
· Email: de@ucolick.org
13. Setting up multi-boxes PostgreSQL with just one monitor
You can stack up the cpu-boxes and connect to just one monitor and use
the KVM (Keyboard, Video, Monitor) switch box to select the host.
This saves space and you eliminate monitor, keyboard and the mouse
(saving anywhere from 100 to 500 US dollars per set) and also avoid
lot of clutter.
Using this switch box, you can stack up many PostgreSQL servers
(development, test, production), Web servers, ftp servers, Intranet
servers, Mail servers, News servers in a tower shelf. The switch box
can be used for controlling Windows 95/NT or OS/2 boxes as well.
Please check out these sites:
· DataComm Warehouse Inc Call 24 hours a day, 7 days a week at
1-800-328-2261. They supply all varieties of computer hardware
4-port Manual KVM switch (PS/2) is about
$89.99 Part No. DDS1354
· Network Technologies Inc
(120 dollars/PC 8
ports) which lists
· Scene Double Inc, England
· Cybex corporation
· Raritan Inc
· RealStar Solutions Inc
· Belkin Inc
· Better Box Communications Ltd.
· Go to nearest hardware store and ask for "Server Switch" also known
as "KVM Auto Switches".
Search engine yahoo to find more companies with "Server Switches" or
"KVM Switches".
It is strongly recommended to have a dedicated unix box for each
PostgreSQL data-server for better performance. No other application
program/processes should run on this box. See the Business section of
your local newspapers for local vendors selling only intel box, 13"
monochrome monitor (very low cost monitor). Local vendors sell just
the hardware without any Microsoft Windows/DOS (saves you about $
150). You do not need a color monitor for the database server, as you
can do remote administration from color PC workstation. Get RedHat
(or some other distribution of) Linux cdrom from below -
· Linux System Labs Web site: 7 (U.S.
dollars)
· Cheap Bytes Inc Web site: 7 (U.S.
dollars)
Make sure that the hardware you purchase is supported by Redhat
Linux. Check the ftp site of Redhat for recommended hardware like
SCSI adapters, video cards before buying. For just $ 600 you will
get a powerful intel box with Redhat Linux running PostgreSQL. Use
odbc/jdbc/perl/tcl to connect to PostgreSQL from Windows95, OS/2,
Unix Motif or web browser (e.g. Redbaron, Opera, Netscape, 20
others). (Web browsers are very fast becoming the standard
client).
Using this idea you can control many cpu boxes by just one monitor and
one keyboard!
Below is the extract from networktechnic Inc for the "Server Switches"
Order now call 800-742-8324 (toll free in USA)
To receive our catalog please Email your address to:
sales@networktechinc.com
CONTROL MULTIPLE PC'S with one keyboard monitor & mouse These
electronic switches will allow one keyboard, monitor & mouse to
control up to 64 PC's. Embedded microcomputers simulate the presence
of keyboard, monitor & mouse to all attached PC's 100% of the time.
Features and Applications
· Keyboard, front panel or remote control
· 9 pin D Serial or 6 pin miniDIN mouse support
· 5 pin DIN or 6 pin miniDIN keyboard support
· 1600x1200 video resolution with no degradation
· Uses standard cables
· Desktop or rackmount
Specifications - Keyboard
· All connectors are female
· 5 pin DIN or 6 pin miniDIN
· Will hard or soft boot all PC's 100% of the time
Controls - Buttons on Front
· Touch a button and be connected to that PC
· Hold any button in for more than 0.5 second and go into SCAN,
BROADCAST or COMMAND mode
· LEDs on front indicate mode of operation Keyboard
· Type CTRL+* and go into COMMAND mode
· SCAN, BROADCAST or COMMAND are available
Mouse
* 9 pin D serial
· o NTI switch emulates Microsoft serial mouse to all PC's
· o 9 pin D male for mouse
· o 9 pin D female for PC's
* 6 pin miniDIN
· o NTI switch emulates IBM PS/2 style mouse to all PC's
· o All connectors are female
Wired remote
· Optional--must be purchased
· Operates same as "Buttons on Front"
Monitor-VGA
· Bandwidth is 150 MHz
· 1600X1200 resolution with no degradation
· All connectors are female
14. Applications and Tools for PostgreSQL
14.1. PostgreSQL 4GL for web database applications - AppGEN Develop
ment System
AppGEN can be downloaded from
·
· .
AppGEN is a high level fourth generation language and application
generator for producing World Wide Web (WWW) based applications.
These applications are typically used over the internet or within a
corporate intranet. AppGEN applications are implemented as C
scripts conforming to the Common Gateway Interface (CGI) standard
supported by most Web Servers.
To use AppGEN you will need the following :-
PostgresSQL, relational database management system
A CGI compatible web server such as NCSA's HTTPD
An ansi C compiler such as GCC
AppGEN consists of the following Unix (Linux) executables :-
· defgen, which produces a basic template application from a logical
data structure. The applications are capable of adding, updating,
deleting and searching for records within the database whilst
automatically maintaining referential integrity.
· appgen, the AppGEN compiler which compiles the appgen source code
into CGI executable C source and HTML formatted documents ready for
deployment on a web server.
· dbf2sql, a utility fo converting dBase III compatible .dbf files
into executable SQL scripts. This enables data stored in most
DOS/Windows based database packages to be migrated to a SQL server
such as PostgresSQL.
· In addition, AppGEN comprises of a collection of HTML documents,
GIF files and Java applets which are used at runtime by the system.
And of course, like all good software, the full source code is
included.
The author, Andrew Whaley, can be contacted on
· andrew@arthur.smuht.nwest.nhs.uk
14.2. WWW Web interface for PostgresSQL - DBENGINE
dbengine a plug 'n play Web interface for PostgreSQL created by Ingo
Ciechowski. It is at
·
About DBENGINE : dbengine is an interface between the WWW and
Postgres95 which provides simple access to any existing database
within just a few minutes.
PHP 3 gives you a Perl like language in your documents, but no real
Perl while AppGen and wdb-p95 require that you create some
configuration file for each of your databases -- sound's like you'll
first of all have to learn some sort of new mata language before you
can get started.
Unlike other tools you don't have to learn any special programming or
scripting language to get started with dbengine. Also there's no
configuration file for each database, so you don't have to get
familiar with such a new structure. However - in case you want to
gain access to the full features of dbengine it'd be a good idea to
know the Perl language.
The whole system can be configured by simple manipulations of an
additional database that contains closer information about how to
visualize your database access. You can even specify virtual Fields
which are calculated on the fly right before they're displayed on the
screen.
License : dbengine is free software under the same terms as Perl. Read
its licence if you aren't sure what you can or can't do. The bottom
line is that this is a kinder and gentler version of the GNU licence
-- one that doesn't infect your work if you care to borrow from
dbengine or package up pieces of it as part of a commercial product.
14.3. Apache Webserver Module for PostgreSQL - NeoSoft NeoWebScript
Apache is a well-known Web Server. And a module to interface
PostgreSQL to Apache Webserver is at -
·
NeoWebScript is a programming language that allows both simple and
complex programs to be embedded into HTML files.
When an HTML page containing embedded NeoWebScript is requested, the
NeoWebScript-enabled webserver executes the embedded script(s),
producing a webpage containing customized content created by the
program.
NeoWebScript is a fast, secure, easy to learn way to do powerful,
server-based interactive programming directly in the HTML code in web
pages. With NeoWebScript, counters, email forms, graffiti walls, guest
books and visitor tracking are all easy, even for a beginning
programmer. See how well NeoWebScript holds its' own vs. PERL and
JavaScript.
If you'd like to install NeoWebScript on your webserver, your
Webmaster needs to read our Sysop FAQ to get started. Theory of
Operations will explain how NeoWebScript works, while installation
will take them through the steps. Management deals with configuration
issues and running the server, tests let you verify correct
NeoWebScript operation, and troubleshooting deals with server
problems.
There is no cost to you to use NeoWebScript-2.2 for your ISP, your
intranet, or your extranet. You'll see a full license when you
register to download, but it costs $ 99 if you want to embed it in
your own product or use it in a commerce (eg. SSL) server.
NeoWebScript is a module for the Apache webserver that allows you to
embed the Tcl/Tk programming language in your webpages as a scripting
tool. It was invented by Karl Lehenbauer, NeoSoft's Chief Technical
Officer, and documented, enhanced and extended by NeoSoft's
programmers and technical writers.
The Apache webserver is the world's most popular webserver, accounting
for 68 % of the sites polled.
Tcl/Tk is the powerful, free, cross-platform scripting language
developed by Dr. John Ousterhout. In his own words
"Tcl/Tk lets software developers get the job done ten times faster
than with toolkits based on C or C++. It's also a great glue language
for making existing applications work together and making them more
graphical and Internet-aware."
Karl Lehenbauer, Founder and Chief Technical Officer of NeoSoft, has
been part of Tcl/Tk development from the very beginning. Together
with Mark Diehkans, they authored Extended Tcl, also known as TclX or
NeoSoft Tcl, a powerful set of extensions to the language. Many of the
current core Tcl commands originated in Extended Tcl, and were then
imported into the core language by Dr. Ousterhout.
NeoSoft Inc., 1770 St. James Place, Suite 500, Houston, TX 77056 USA
14.4. HEITML server side extension of HTML and a 4GL language for
PostgreSQL
Tool heitml is another way to interface postgres with the world wide
web. For more details contact
Helmut Emmelmann H.E.I. Informationssyteme GmbH
Wimpfenerstrasse 23 Tel. 49-621-795141
68259 Mannheim Germany Fax. 49-621-795161
· E-mail Mr.Helmut Emmelmann at emmel@h-e-i.de
· Heitml main web site
· Heitml secondary web site
heitml is a server side extension of HTML and a 4GL language at the
same time. People can write web applications in the HTML style by
using new HTML-like tags.
heitml (pronounced "Hi"-TML) is an extension of HTML and a full-
featured 4th generation language that enables Web-based Applications
to interact with data stored in SQL databases, without resorting to
complex CGI scripts.
heitml extends HTML on the sever side, dynamically converting ".hei"
files to HTML format and so is compatible with any web browser.It
embraces the familiar, easy-to-use HTML syntax and provides a large
assortment of pre-developed Tags and Libraries to take care of tasks
that formerly required CGI. As XML, heitml provides user defined tags.
With heitml the user defined markup can be translated to HTML and send
to a browser.
heitml targets both HTML designers and professional programmers alike.
HTML designers can use heitml Tags to build dynamic web pages, access
SQL databases, or create complete web applications. Counters,
registration databases, search forms, email forms, or hierarchical
menues can all be created simply by using the pre-developed HTML-like
Tags found in the many Component Libraries.
For programmers heitml embeds a complete forth generation language in
HTML
(e.g. , , and Tags),
plus powerful expression evaluation with integer, real, boolean,
string, and tuple data types. Tuples have reference semantics as in
modern object oriented languages and are stored on a heap. heitml
variables including all complex data structures stored on the heap
maintain their values between pages using the Session Mode. It is pos
sible to define your own tags or environment tags and even re-define
HTML-tags.
heitml makes it possible to
- - - develop Web Sites in a structured and modular way, drastically
reducing maintenance overhead.
- - - develop intelligent and interactive Web Sites, with content that
dynamically adapts itself to user needs.
- - - show the content of SQL databases with no programming other than
to use our library of prefined "dba" Tags.
- - - develop complex database and Catalog Shopping applications using
Session Variables
heitml runs on Linux with any Web Server using the CGI interface, and
is especially fast (avoiding the CGI overhead) within the APACHE Web
Server using the apache API. Currently MSQL (Version 1 and 2),
PostgreSQL (Version 6), mysql, and the yard databases are supported).
heitml also works on Linux, BSDi, Solaris and SunOS, as well as
Windows NT with CGI and ISAPI and ODBC and Windows 95.
heitml (on linux) is free for research, non-commercial and private
usage. Commercial Web Sites must pay a licensing fee. The fully
operational version of heitml is available for a trial period
downloaded freely. (Note, however, that each ".hei" Web Page you
develop will display a message identifying it as the version for non-
commercial use. After registration, you will receive a key to switch
off the message without having to re-install the program.)
heitml (pronounced "Hi"-TML) significantly extends and enhances the
functionality of HTML by definable tags and full programming features.
This makes dynamic content and database applications possible simply
within the HTML world, without CGI and without external scripting or
programming languages. This means you, as an HTML author, can embed
applications in your web pages, simply by using some new tags without
CGI and without programming. As an advanced user or programmer on the
other hand you can create and program powerful tag libraries. This
approach makes heitml suitable for HTML newcomers and professional
programmers alike. heitml runs on the web server and dynamically
generates HTML, so heitml is compatible with the internet standards
and with any web browser. It allows full access to databases while
shielding the user from any unneccessary CGI complexity. heitml has
been developed according to the newst research and in compiler
construction and transaction systems.
heitml pages are developed just the same way as HTML pages, with a
text editor or HTML editor, and placed on the web server as usual.
However now pages can contain dynamic heitml tags and access tag
libraries. You can use these tags to access the database, to create
dynamic content, to send emails, and even to create powerful
applications like registration databases and shopping systems.
HTML newcomers and professional programmers alike will be amazed at
how quickly and easily they can design exciting applications like our
Interactive Guestbook without resorting to complex and difficult to
learn CGI scripts, simply by using the tools provided in our dba
Library.
heitml is accompanied by a wide range of tag libraries, to create
guestbooks, database maintenance applications, extensible query forms,
powerful email forms or structure your web site using a hierarchic
menu. These tools are ready to go, just add the corresponding tags to
your web site.
As an experienced programmer you can make fully use of the heitml
persistent dynamic tuple architecture : heitml is not just a scripting
language with dynamic typing, full power expression evaluation,
recursive procedures and extensive parameter passing features, but it
also features persistent dynamic tuples to automatically keep session
data of any size.
14.5. America On-line AOL Web server for PostgreSQL
The no-cost commercial webserver, AOLserver version 2.3 supports
database connections to PostgreSQL 6.2.1 and higher. for more info
see
· AOL Web Server
14.6. Problem/Project Tracking System Application Tool for PostgreSQL
This is at
·
14.7. Convert dbase dbf files to PostgreSQL
The program dbf2msql works fine with mSQL and PostgreSQL. You can find
it at
·
·
This program was written by Maarten Boekhold, Faculty of Electrical
Engineering TU Delft, NL Computer Architecture and Digital Technique
section
· M.Boekhold@et.tudelft.nl
You can also use a python method to read dbf files and load into a
postgres database.
· See
15. Web Database Design/Implementation tool for PostgreSQL - EARP
·
· in the directory 'pub/unix/earp'.
15.1. What is EARP ?
The "Easily Adjustable Response Program" (EARP) created by David
Dougherty. EARP is a Web Database Design/Implementation tool, built
on top of the PostgreSQL database system. Its functionality includes:
· A Visual Design System.
· A sendmail interface. (can handle incoming and outgoing mail)
· An Enhanced Security Mechanism.
· A cgi driver.
15.2. Implementation
The main implementation of EARP is a CGI binary which runs under the
http daemon to provide access to the database server. All of the
design tools are built into the driver, no design takes place over
anything but the web. The tools themselves require a graphical
browser, the compatibility of objects designed with the tools is
implementation independent, based on designing individuals
preferences.
15.3. What you need to run EARP
EARP will likely run on a variety of platforms with little or no
porting. The known working platforms consist of the following:
· Solaris 2.5
· Linux 1.2.13+
· GNU C++
· PostgreSQL (Version 1.01 / 1.02 )
· netsite server
· NCSA httpd
· GNU C++
· PostgreSQL (Version 1.01 / 1.02 )
· NCSA httpd
· Apache httpd
The current (1.3) release of Earp was designed on top of the libpq
release that came with PostgreSQL v1.01/1.02. If you are using a
more recent version of Postgres, expect that the program will
require some porting to work correctly. In the development version
(Earp 2.0), libpq support is being incorporated as a module.
15.4. How does it work ?
One of the main features of EARP is that it uses an Object Oriented
approach to producing html pages which interface to the database. Most
pages will consist of several objects. Each object is produced by some
sort of tool and given a name, objects are then linked together in a
callable sequence by the page tool. Objects are also reusable across
multiple pages. Basic tools exist for HTML, Querys, Grabbing input
from forms, Extendable Formatting of Query and Input objects, and
Linking together of objects into other objects. More advanced tools
include the mail tool and the multithreaded query tool.
Another feature of EARP is advanced security. Access to various areas
of the EARP system can be limited in a variety of ways. To facilitate
its advanced security, EARP performs checks for each connection to the
system, determining what ids and groups the connecting agent belongs
to. Access to areas is defined seperately, and the combination decides
if access to a specific area of Earp is allowed. Moreover, all that is
required to implement the security features is an http server that
supports basic (or better) user authentication.
15.5. Where to get EARP ?
EARP is available via anonymous ftp from
· in the directory 'pub/unix/earp'.
16. PHP Hypertext Preprocessor - Server-side html-embedded scripting
language for PostgreSQL
WWW Interface Tool is at -
·
·
Old name is Professional Home Pages (PHP 3) and new name is PHP
Hypertext Pre-Processor
· Mirror sites are in many countries like www.COUNTRYCODE.php.net
·
·
·
Questions e-mail to :
· rasmus@lerdorf.on.ca
PHP 3 is a server-side html-embedded scripting language. It lets
you write simple scripts right in your .HTML files much like
JavaScript does, except, unlike JavaScript PHP 3 is not browser-
dependant. JavaScript is a client-side html-embedded language while
PHP 3 is a server-side language. PHP 3 is similar in concept to
Netscape's LiveWire Pro product. If you have the money, you run
Netscape's Commerce Server and you run one of the supported
operating systems, you should probably have a look at LiveWire Pro.
If you like free fast-moving software that comes with full source
code you will probably like PHP 3.
16.1. Major Features
Standard CGI, FastCGI and Apache module Support As a standard CGI
program, PHP 3 can be installed on any Unix machine running any Unix
web server. With support for the new FastCGI standard, PHP 3 can take
advantage of the speed improvements gained through this mechanism. As
an Apache module, PHP 3 becomes an extremely powerful and lightning
fast alternative to CGI programmimg.
· Access Logging With the access logging capabilities of PHP 3, users
can maintain their own hit counting and logging. It does not use
the system's central access log files in any way, and it provides
real-time access monitoring. The Log Viewer Script provides a quick
summary of the accesses to a set of pages owned by an individual
user. In addition to that, the package can be configured to
generate a footer on every page which shows access information. See
the bottom of this page for an example of this.
· Access Control A built-in web-based configuration screen handles
access control configuration. It is possible to create rules for
all or some web pages owned by a certain person which place various
restrictions on who can view these pages and how they will be
viewed. Pages can be password protected, completely restricted,
logging disabled and more based on the client's domain, browser, e-
mail address or even the referring document.
· Postgres Support Postgres is an advanced free RDBMS. PHP 3 supports
embedding Postgres95 and PostgreSQL SQL queries directly in .html
files.
· RFC-1867 File Upload Support File Upload is a new feature in
Netscape 2.0. It lets users upload files to a web server. PHP 3
provides the actual Mime decoding to make this work and also
provides the additional framework to do something useful with the
uploaded file once it has been received.
· HTTP-based authentication control PHP 3 can be used to create
customized HTTP-based authentication mechanisms for the Apache web
server.
· Variables, Arrays, Associative Arrays PHP 3 supports typed
variables, arrays and even Perl-like associative arrays. These can
all be passed from one web page to another using either GET or POST
method forms.
· Conditionals, While Loops PHP 3 supports a full-featured C-like
scripting language. You can have if/then/elseif/else/endif
conditions as well as while loops and switch/case statements to
guide the logical flow of how the html page should be displayed.
· Extended Regular Expressions Regular expressions are heavily used
for pattern matching, pattern substitutions and general string
manipulation. PHP 3 supports all common regular expression
operations.
· Raw HTTP Header Control The ability to have web pages send
customized raw HTTP headers based on some condition is essential
for high-level web site design. A frequent use is to send a
Location: URL header to redirect the calling client to some other
URL. It can also be used to turn off cacheing or manipulate the
last update header of pages.
· On-the-fly GIF image creation PHP 3 has support for Thomas
Boutell's GD image library which makes it possible to generate GIF
images on the fly.
· ISP "Safe Mode" support PHP 3 supports a unique "Safe Mode" which
makes it safe to have multiple users run PHP scripts on the same
server.
· It's Free! One final essential feature. The package is completely
free. It is licensed under the GPL which allows you to use the
software for any purpose, commercial or otherwise. See the GNU
Public License document for complete details.
16.2. Credits
* Large parts of this code were developed at and for the University of
Toronto. Many thanks to Lee Oattes of the Network Development
Department at the university for constant constructive criticism.
* The PostgreSQL support code was written by Adam Sussman
· asussman@vidya.com
* Countless others have helped test and debug the package.
16.3. PHP 3 - Brief History
PHP began life as a simple little cgi wrapper written in Perl. It was
never intended to go beyond own private use. The name of this first
package was Personal Home Page Tools, which later became Personal Home
Page Construction Kit.
A tool was written to easily embed SQL queries into web pages. It was
basically another CGI wrapper that parsed SQL queries and made it easy
to create forms and tables based on these queries. This tool was named
FI (Form Interpreter).
PHP/FI version 2.0 is a complete rewrite of these two packages
combined into a single program. It has now evolved to the point where
it is a simple programming language embedded inside HTML files. The
original acronym, PHP, has stuck. It isn't really appropriate any
longer. PHP/FI is used more for entire web sites today than for small
Personal Home Page setups. By whatever name, it eliminates the need
for numerous small Perl cgi programs by allowing you to place simple
scripts directly in your HTML files. This speeds up the overall
performance of your web pages since the overhead of forking Perl
several times has been eliminated. It also makes it easier to manage
large web sites by placing all components of a web page in a single
html file. By including support for various databases, it also makes
it trivial to develop database enabled web pages. Many people find the
embedded nature much easier to deal with than trying to create
separate HTML and CGI files.
Throughout this documentation any references to PHP, FI or PHP/FI all
refer to the same thing. The difference between PHP and FI is only a
conceptual one. Both are built from the same source distribution. Now
PHP/FI is renamed as PHP 3.
16.4. So, what can I do with PHP/FI ?
The first thing you will notice if you run a page through PHP/FI is
that it adds a footer with information about the number of times your
page has been accessed (if you have compiled access logging into the
binary). This is just a very small part of what PHP/FI can do for you.
It serves another very important role as a form interpreter cgi, hence
the FI part of the name. For example, if you create a form on one of
your web pages, you need something to process the information on that
form. Even if you just want to pass the information to another web
page, you will have to have a cgi program do this for you. PHP/FI
makes it extremely easy to take form data and do things with it.
16.5. A simple example
Suppose you have a form: