Database-SQL-RDBMS HOW-TO document for Linux (PostgreSQL Object Rela­ tional Database System) Al Dev (Alavoor Vasudevan) aldev@hotmail.com v4.0, 21 December 1997 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 about 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 "PostgreSQL" on Unix system which can be used as Application Database Server or as Web Database Server. PostgreSQL implements subset of International standard ISO and ANSI SQL 1998,92,89. This document also gives information on the interface programs for the database like Front End GUIs, RAD tools (Rapid Application Development), programming languages interfaces ("C", "C++", Java, Perl), ODBC, JDBC drivers and Web Database Tools and Interface programs. Information given here applies to all Unix platforms and other databases and will be very useful for people who are new to Databases, SQL language and Post­ greSQL. This document also has SQL tutorial, SQL syntax which would be very helpful for beginners. Experienced people will find this docu­ ment useful as a handy 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 how a RDBMS SQL database engine is written. 1. Introduction Each and every computer system in the world needs a database to store/retrieve the information. Without a database, a computer can become useless. 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. The most popular database systems are based on the International Standard Organisation (ISO) SQL specifications which are also based on ANSI SQL (American) standards. Current specifications generally used are ANSI SQL 92 and ANSI SQL 89. Upcoming standard is the SQL 1998/99 which is also called SQL-3. Popular database like Oracle, Sybase and Informix systems are based on these standards or are trying to implement these standards. As given in this document, 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. Today's customer wants to develop an application once using ISO SQL, ODBC, JDBC and sell it to be used 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 and also all the packages related to databases, 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 Systems development model'. Open systems is the one where the complete source code is given to you and the development takes place on the internet by a extremely large network of human brains. Future trend foresees 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 customers. Applying the principles of physics (quantum, classical, thermodynamics), mathematics and statistics to software quality, you get the highest quality of software only in a 'Open Systems' like PostgreSQL by opening the source code to a very vast number of human brains interconnected by the information super-highway. Greater the number of human brains working, the better will be the quality of software. Open Systems 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. 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. 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(99 %). Hardware is the real work horse and software is just a minor contributor. That is, work done by the software is insignificant as compared to that of the computer hardware. Computer hardware is so much more complex that only 6 out of 180 countries in the world so far have demonstrated the capability of designing and manufacturing computer chips/hardware. Manufacturing computer chips is a super-high technology and is a very complex process, capital intensive requiring large investments in plant and production machines which deal with 0.25 micron technology, billions of transistors/circuits which are densely packed on a small silicon chip, which to date even many of the developed countries cannot afford to manufacture! Companies like AMD, Intel, Cyrix, Hitachi, IBM and others spent billions of man-years to master the high-technology like Micro-electronics and Nano-electronics. Micro means (one-millionth of centimeter), Nano means (one-billionth of centimeter). Current technology uses micro-electronics of about 0.35 micron using aluminum as conductors, 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. As you can see, it is hardware that is high technology and important and software is a low technology and is NOT as important. Hence, manufacturing hardware/hard-goods is vital for national economy! Companies like Compaq, 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 20 years (Oracle database server is over some 20 man-years). One man-year is one person working full-time for one full year. If 20 people work for a year than it is 20 man-years spent. Databases like Oracle, Informix, Sybase, IBM DB2 are written in nothing but 100% "C" language and binaries are created by compiling the source and than shipped to customers. 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 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 'Internet Product' and demands due respect and appreciation from one and all. Prediction is that demand for "Made By 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 By Internet' products will be seriously missing "World-wide Internet Revolution" and will be left far behind other countries. 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/Database-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 ControlPanel | Applications | Graphics menu buttons. The gv program is much more user friendly than ghostscript. To read postscript document give the command - gv howto.ps To use ghostscript give - ghostscript howto.ps You can read HTML format document using Netscape Navigator, Microsoft Internet explorer, Redhat Baron Web browser or any of the 10 other web browsers. 3. Laws of Physics applies to Software! Laws of science (Physics) applies everywhere, all the time, to anything that you do and even to software projects like database systems. Physics is in action even while you are talking (sound waves), walking (friction between ground and your feet), sleeping or writing software. Every software developer/user must have a very basic and minimum understanding of the science - namely Physics, Quantum Mechanics, Thermodynamics, Statistics and Mathematics. It is suggested you give atleast one reading to a "Introductory/Basic" textbook on the above subjects. As per science, it is impossible to build a database software system which will be 100 % perfect and bug free. But by combining the energies of millions of people around the world via internet it is possible to achieve a near perfect 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 perfect system. It is very clear that internet can network a vast number of people, which implies internet can produce high quality software products. Science would like every software developer and end-user not to be narrow-single-track minded but to be open and give a chance to "The Internet Products" like PostgreSQL, Linux, etc.. 4. What is PostgreSQL ? PostgreSQL Version 6.2.1 patch level 3 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 - cd "To postgresql source directory" patch < "Specify a patch file here" make clean make 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 latter be incorporated into the ANSI/ISO SQL. PostgreSQL is the "state of the art" technology database. 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. 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. (Version 7.0 will make these capabilities even more advanced). 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.2.1 patch level 3 · Age: PostgreSQL is 12 years old. Developed since 1985 · Authors: Developed by millions/universities/companies on internet for the past 12 YEARS 5. Where to get it ? You can buy Redhat 4.2 Linux CDROM, Debian Linux CDROM or Slackware Linux CDROM which already contains the postgresql in rpm package (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 contact: Oliver.Elphick@lfix.co.uk In near future PostgreSQL organisation will be selling 'PostgreSQL CDROM' which will contain the complete source code and binaries for all the Unix operating systems. Binaries only distribution of PostgreSQL: · You can run PostgreSQL without compiling the source. Get binaries for Intel-Linux from file is postgresql-6.2-3.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.2-3.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 rapidly decline when the database size exceed 5 gig. You can run 30 gig database on 32-bit cpu but it will not be very effective. There is limitation imposed on the amount of RAM (maximum of 2 gig only), limitation on the file system sizes and also on the operating system. The operating system on 32-bit cpu will be "bumping it's head" too many times on the "32-bit ceiling". If you need to use extremely large databases (greater than 5 gigabytes), it is strongly advised that you use 64-bit machines like Digital Alpha cpu, Sun Ultra-sparc 64-bit cpu, Silicon graphics 64-bit cpu, upcoming Intel Merced IA-64 cpu, HPUX 64bit machines, 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 Regression test package (src/test/regress) is included in the distribution and let your computer do the verification for standard SQL operations as well as the extensibility capabilities of PostgreSQL. Advantage is that computer can rapidly run millions of SQL tests in a very short time. The speed of computer is about one billion times faster than human brain! In 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 instead of using the human brain power. The test package already contains hundreds of SQL test programs. You can start the regression test (relax and have a cooldrink!) and come back take a glance at the output results and you are done! It is that simple and easy. 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 without any major worries. Regression test package can be taken as a "very solid" technical specification mutually agreed upon document 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. 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 very powerful scripting language. Develop once and run it everywhere on NT, Win 95, Linux, OS/2 and all unixes! TCL/TK is also widely used as a Internet script language. So you will have only one language for all your needs - applications and internet. 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. TCL/TK is usually shipped with every linux cdrom. Also you can get it from these sites - · · · · Reference text book: Many textbooks on TCL/TK are available in the market. · Visual TCL 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. This 800 US dollars product is available for Linux at a very special low price 79 US dollars for a limited time. Check it out! This is a developer's dream. · More information on Vibe at You can also use Borland C++ Builder, Delphi, Borland JBuilder, PowerBuilder on Windows95 connecting to PostgreSQL on unix box through ODBC/JDBC drivers. Free of cost IDE Tools - Check the CDROM of redhat linux distribution. · FreeBuilder · SpecTCL · JccWarrior · Applixware Tool · XWPE X Windows Programming Environment · XWB X Windows Work Bench · NEdit 10. Kanchenjunga - Java RAD Tool for PostgreSQL Kanchenjunga is a Java Rapid Application Tool for PostgreSQL. You can use this tool to develop rapidly the java application interfacing PostgreSQL. · 11. Interface Drivers for PostgreSQL 11.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.. · 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. · This is the primary PostODBC (PostgreSQL ODBC) site. Unfortunately it has proved to be rather slow for sites that are not located in Austria. · This mirror is maintained by Julia Anne Case who is also a major PostODBC developer. There is an interesting project called the FreeODBC Pack Package . There's no PostgreSQL Version there, maybe you can help. · This is a cost free version of ODBC. 11.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. 11.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. 11.4. Java Classes for PostgreSQL Java programmers can find these classes for PostgreSQL very useful. · · 12. Perl Database Interface (DBI) Driver for PostgreSQL 12.1. Perl 5 interface for PostgreSQL It is included in the distribution of PostgreSQL. Check in src/pgsql_perl5 directory. · Email: E.Mergl@bawue.de · Another source from - · Perl Home page : 12.2. 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. 12.3. Announcement DBD-Pg-0.63 DBI driver for PostgreSQL On its way to CPAN is DBD-Pg-0.63.tar.gz. Since the last public release the following changes have been made: - - adapted to PostgreSQL-6.2: o $ sth->rows as well as $ sth->execute and $ sth->do return the number of affected rows even for non-Select statements. o support for password authorization added, please check the man-page for pg_passwd. - - the data_source parameter of the connect method accepts two additional parameters which are treated as host and port: DBI->connect("dbi:Pg:dbname:host:port", "uid", "pwd") - - support for AutoCommit, please read the module documentation for impacts on your scripts ! - - more perl-ish handling of data type bool, please read the module documentation for impacts on your scripts ! for further information see: 12.4. Release Notes and ReadMe file #--------------------------------------------------------- # # $Id: README,v 1.10 1997/10/05 18:25:55 mergl Exp $ # # Portions Copyright (c) 1994,1995,1996,1997 Tim Bunce # Portions Copyright (c) 1997 Edmund Mergl # #--------------------------------------------------------- ********************************************************** * * * This release makes changes which are * * INCOMPATIBLE * * ------------ * * to previous releases. * * * * Please check the module documentation * * for the attribute AutoCommit * * and for the data type bool. * * * ********************************************************** DESCRIPTION: ------------ This is version 0.63 of DBD-Pg. DBD-Pg is a PostgreSQL interface for Perl 5 using DBI. For further information about DBI look at: COPYRIGHT: ---------- You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file. IF YOU HAVE PROBLEMS: --------------------- 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. 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) PLATFORMS: ---------- This release of DBD-Pg has been developed using Linux 2.0 with dynamic loading for the perl extensions. Let me know, if there are any problems with other platforms. INSTALLATION: ------------- The Makefile checks the environment variable POSTGRES_HOME as well some standard locations, to find the root directory of your Postgres installation. 1. perl Makefile.PL 2. make 3. make test 4. make install ( 1. to 3. as normal user, not as root ! ) TESTING: -------- Run 'make test'. Note, that the user running this script must have been created with the access rights to create databases *AND* users ! Do not run this script as root ! If testing fails with the message 'login failed', please check if access to the database template1 as well as pgperltest is not protected in pg_hba.conf. If you are using the shared library libpq.so check if your dynamic loader finds libpq.so. With Linux the command /sbin/ldconfig -v should tell you, where it finds libpq.so. If ldconfig does not find libpq.so, either add an appropriate entry to /etc/ld.so.conf and re-run ldconfig or add the path to the environment variable LD_LIBRARY_PATH. A typical error message resulting from not finding libpq.so is: install_driver(Pg) failed: Can't load './blib/arch/auto/DBD/Pg/Pg.so' for module DBD::Pg: File not found at Some linux distributions have an incomplete perl installation. If you have compile errors like "XS_VERSION_BOOTCHECK undeclared", make a If this file is not present, you need to recompile and reinstall perl. SGI users: if you get segmentation faults make sure, you use the malloc which comes with perl when compiling perl (the default is not to). "David R. Noble" drnoble@engsci.sandia.gov drnoble@engsci.sandia.gov --------------------------------------------------------------------------- E.Mergl@bawue.de October 05, 1997 --------------------------------------------------------------------------- 12.5. FAQ for DBI Below is the Frequently Asked question FAQ for DBI. The main web page is at DBI Frequently Asked Questions v.0.35 Last updated: June 20th, 1997 * NAME * SYNOPSIS * VERSION * DESCRIPTION * Basic Information & Information Sources * 1.1 What is DBI, DBperl, Oraperl and *perl? * 1.2. Where can I get it from? * 1.3. Where can I get more information? * Compilation Problems * 2.1. Compilation problems or "It fails the test!" * Platform and Driver Issues * 3.1 What's the difference between ODBC and DBI? * 3.2 Is DBI supported under Windows 95 / NT platforms? * 3.3 Can I access Microsoft Access or SQL-Server databases with DBI? * 3.4 Is the a DBD for >? * 3.5 What's DBM? And why should I use DBI instead? * 3.6 When will mSQL-2 be supported? * 3.7 What database do you recommend me using? * 3.8 Is > supported in DBI? * Programming Questions * 4.1 Is DBI any use for CGI programming? * 4.2 How do I get faster connection times with DBD::Oracle and CGI? * 4.3 How do I get persistent connections with DBI and CGI? * 4.4 ``When I run a perl script from the command line, it works, but, when I run it under the C, it fails!'' Why? * 5.1 Can I do multi-threading with DBI? * 5.2 How do I handle BLOB data with DBI? * 5.3 How can I invoke stored procedures with DBI? * 5.4 How can I get return values from stored procedures with DBI? * 5.5 How can I create or drop a database with DBI? * 5.6 How can I C or C a statement with DBI? * 5.7 How are C values handled by DBI? * 5.8 What are these C methods all about? * Support and Training * Commercial Support * Training * Other References * AUTHOR ---------------------------------------------------------------------------- NAME DBI::FAQ -- The Frequently Asked Questions for the Perl5 Database Interface ---------------------------------------------------------------------------- SYNOPSIS perldoc DBI::FAQ ---------------------------------------------------------------------------- VERSION This document is currently at version 0.35, as of June 20th, 1997. ---------------------------------------------------------------------------- DESCRIPTION This document serves to answer the most frequently asked questions on both the DBI Mailing Lists and personally to members of the DBI development team. ---------------------------------------------------------------------------- Basic Information & Information Sources ---------------------------------------------------------------------------- 1.1 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. Here's a diagram that demonstrates the principle: [ DBI Architecture ] 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. Please note, the author's listed here generally do not maintain the DBI module for the same database. These email addresses are unverified and should only be used for queries concerning the perl4 modules listed below. DBI driver queries should be directed to the dbi-users mailing list. Module Name Database Required Author DBI ----------- ----------------- ------ --- Sybperl Sybase Michael Peppler DBD::Sybase 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::Oracle 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: http://www.perl.com/cgi-bin/cpan_mod?module=Msqlperl ---------------------------------------------------------------------------- 1.2. Where can I get it from? DBI is primarily distributed from: ftp://ftp.demon.co.uk/pub/perl/db The Comprehensive Perl Archive Network resources should be used for retrieving up-to-date versions of the drivers, since local mirror sites usually lag. CPAN may be accessed via Tom Christiansen's splendid CPAN multiplexer program located at: http://www.perl.com/CPAN/ For more specific version information and exact URLs of drivers, please see the DBI drivers list and the DBI module pages which can be found on: http://www.hermetica.com/technologia/perl/DBI ---------------------------------------------------------------------------- 1.3. Where can I get more information? There are a few information sources on DBI. DBI Specification http://www.hermetica.com/technologia/perl/DBI/doc/dbispec 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 latter 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: perldoc DBI command. 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 This document, the Frequently Asked Questions is also available as POD documentation! You can read this on your own system 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 http://www.hermetica.com/technologia/perl/DBI/tidbits There are a series of occasional rambles from various people on the DBI mailing lists who, in an attempt to clear up a simple point, end up drafting fairly comprehensive documents. These are quite often varying in quality, but do provide some insights into the workings of the interfaces. ``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: http://www.tpj.com ``DBperl'' This article, published in the November 1996 edition of ``Dr. Dobbs Journal'' concerned DBperl. The author of this edition apparently did not bother to contact any of the DBI development team members for verification of the information contained within his article. Several reviews of the article on the dbi-users mailing list were disparaging, to say the least. The fact the article was written about DBperl instead of DBI hints at the staleness of the information. However, we include the reference for completeness' sake. ``The Perl5 Database Interface'' This item is a book to be written by Alligator Descartes ( for it is me ) and published by O'Reilly and Associates this coming Winter. Here is the putative table of contents for the book. * Introduction + Databases + CGI / WWW + perl * Basic Database Concepts + Types of Database o Flat File o AnyDBM o RDBMS + Using Which Database For What... * SQL + Why SQL? + Structuring Information In Databases + Retrieving Data From Databases + Manipulating Data and Data Structures * DBI Architecture * Programming with DBI + DBI Initialization + Handles o Driver Handles o Database Handles o Statement Handles + Connection and Disconnection + Handling Errors + Issuing Simple Queries + Executing Atomic Statements + Statement MetaData + More perl-ish Statements + Binding + Transaction Handling + Utility Methods + Handle Attributes and Dynamic Variables * DBI and ODBC * The Database Drivers + DBD::Oracle and oraperl + DBD::Informix and isqlperl + DBD::mSQL and Msqlperl * Case Studies + DBI and the WWW + Data Migration and Warehousing + Administration Software * Appendix: API Reference / Specification * Appendix: Resources README files The README files included with each driver occasionally contains some useful information ( no, really! ) that may be pertinent to the user. Please read them. It makes our worthless existences more bearable. These can all be read from the main DBI WWW page at: http://www.hermetica.com/technologia/perl/DBI 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 the URL of: http://www.fugue.com/dbi The lists that users may participate in are: dbi-announce This mailing list is for announcements only. Very low traffic. The announcements are usually posted on the main DBI WWW page. 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. Low traffic. 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. Medium traffic. 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 http://outside.organic.com/mail-archives/dbi-users/ Searchable hypermail archives of the three mailing lists, and some of the much older traffic have been set up for users to browse. European Mailing List Archives http://www.rosat.mpe-garching.mpg.de/mailing-lists/PerlDB-Interest As per the US archive above. ---------------------------------------------------------------------------- Compilation Problems ---------------------------------------------------------------------------- 2.1. Compilation problems or "It fails the test!" First off, consult the online information about the module, beit DBI itself, or a DBD, and see if it's a known compilation problem on your architecture. These documents can be found at: http://www.hermetica.com/technologia/perl/DBI If it's a known problem, you'll probably have to wait till it gets fixed. If you're really needing it fixed, try the following: Attempt to fix it yourself This technique is generally not recommended to the faint-hearted. If you do think you have managed to fix it, then, send a patch file ( context diff ) to the author with an explanation of: o What the problem was, and test cases, if possible. o What you needed to do to fix it. Please make sure you mention everything. o Platform information, database version, perl version, module version and DBI version. Email the author Do NOT whinge! Please email the address listed in the WWW pages for whichever driver you are having problems with. Do not directly email the author at a known address unless it corresponds with the one listed. We tend to have real jobs to do, and we do read the mailing lists for problems. Besides, we may not have access to and couldn't be of any assistance anyway! Apologies for sounding harsh, but that's the way of it! However, you might catch one of these creative genii at 3am when we're doing this sort of stuff anyway, and get a patch within 5 minutes. The atmosphere in the DBI circle is that we do appreciate the users' problems, since we work in similar environments. If you are planning to email the author, please furnish as much information as possible, ie: o ALL the information off the README file in the problematic module. And we mean ALL of it. We don't put lines like that in documentation for the good of our health, or to meet obscure README file standards of length. o If you have a core dump, try the Devel::CoreStack module for generating a stack trace from the core dump. Send us that too. Devel::CoreStack can be found on CPAN at: http://www.perl.com/cgi-bin/cpan_mod?module=Devel::CoreStack o Module versions, perl version, test cases, operating system versions and any other pertinent information. Remember, the more information you send us, the quicker we can track problems down. If you send us nothing, expect nothing back. Email the dbi-users Mailing List It's usually a fairly intelligent idea to cc the mailing list anyway with problems. The authors all read the lists, so you lose nothing by mailing there. ---------------------------------------------------------------------------- Platform and Driver Issues ---------------------------------------------------------------------------- 3.1 What's the difference between ODBC and DBI? Good question! To be filled in more detail! ---------------------------------------------------------------------------- 3.2 Is DBI supported under Windows 95 / NT platforms? Finally, yes! Jeff Urlwin has been working diligently on building DBI and DBD::Oracle under these platforms, and, with the advent of a stabler perl and a port of MakeMaker, the project has come on by great leaps and bounds. 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. For the DBD::Oracle patches required, please read the Win32 porting page at: http://www.hermetica.com/technologia/perl/DBI/win32 ---------------------------------------------------------------------------- 3.3 Can I access Microsoft Access or SQL-Server databases with DBI? Contributed by Tim Bunce and Jeff Urlwin Supplied with DBI-0.79 ( and later ) is an experimental DBI 'emulation layer' for the Win32::ODBC module. It's called DBI::W32ODBC and is, at the moment, very minimal. You will need the Win32::ODBC module available from: http://www.roth.net Given its status, problem reports without fixes are likely to be ignored. You will also need the Win32 DBI patch kit as supplied by Jeff Urlwin, which you can locate by reading the previous question's answer. Jeff Urlwin is currently working hard on the ODBC layer. To get back to the question, theoretically, yes, you can access Microsoft Access and SQL-Server databases from DBI via ODBC! ---------------------------------------------------------------------------- 3.4 Is the a DBD for ? Is is listed on the DBI drivers page? http://www.hermetica.com/technologia/perl/DBI/DBD If not, no. A complete absence of a given database driver from that page means that no-one has announced any intention to work on it. A corollary of the above statement implies that if you see an announcement for a driver not on the above page, there's a good chance it's not actually a DBI driver, and may not conform to the specifications. Therefore, questions concerning problems with that code should not really be addressed to the DBI Mailing Lists. ---------------------------------------------------------------------------- 3.5 What's DBM? And why should I use DBI instead? Extracted from ``DBI - The Database Interface for Perl 5'': ``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. ---------------------------------------------------------------------------- 3.6 When will mSQL-2 be supported? As of DBD::mSQL-0.61, there has been support for mSQL-2. However, there is no real support for any of the new methods added to the core mSQL library regarding index support yet. These are forthcoming and will be accessible via func methods private to DBD::mSQL. You can read more about these private methods in the DBD::mSQL POD that can be found by typing: perldoc DBD::mSQL provided you have DBD::mSQL correctly installed. ---------------------------------------------------------------------------- 3.7 What database do you recommend me using? This is a particularly thorny area in which an objective answer is difficult to come by, since each dataset, proposed usage and system configuration differs from person to person. From the current author's point of view, if the dataset is relatively small, being tables of less than 1 million rows, and less than 1000 tables in a given database, then mSQL is a perfectly acceptable solution to your problem. This database is extremely cheap, is wonderfully robust and has excellent support. More information is available on the Hughes Technology WWW site at: http://www.hughes.com.au If the dataset is larger than 1 million row tables or 1000 tables, or if you have either more money, or larger machines, I would recommend Oracle7 RDBMS. Oracle's WWW site is an excellent source of more information. http://www.oracle.com Informix is another high-end RDBMS that is worth considering. There are several differences between Oracle and Informix which are too complex for this document to detail. Information on Informix can be found on their WWW site at: http://www.informix.com In the case of WWW fronted applications, mSQL may be a better option due to slow connection times between a CGI script and the Oracle RDBMS and also the amount of resource each Oracle connection will consume. mSQL is lighter resource-wise and faster. These views are not necessarily representative of anyone else's opinions, and do not reflect any corporate sponsorship or views. They are provided as-is. ---------------------------------------------------------------------------- 3.8 Is 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. ---------------------------------------------------------------------------- Programming Questions ---------------------------------------------------------------------------- 4.1 Is DBI any use for CGI programming? In a word, yes! DBI is hugely useful for CGI programming! In fact, I would tentatively say that 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. ---------------------------------------------------------------------------- 4.2 How do I get faster connection times with DBD::Oracle and CGI? Contributed by John D. Groenveld 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: http://www.apache.org The mod_perl module can be downloaded from CPAN via: http://www.perl.com/cgi-bin/cpan_mod?module=mod_perl ---------------------------------------------------------------------------- 4.3 How do I get persistent connections with DBI and CGI? Contributed by John D. Groenveld 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: http://www.perl.com/cgi-bin/cpan_mod?module=Apache::DBI ---------------------------------------------------------------------------- 4.4 ``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. The ``Idiot's Guide To Solving Perl / CGI Problems'' can be located at: http://www.perl.com/perl/faq/index.html as can the ``Perl CGI Programming FAQ''. Read BOTH these documents carefully! ---------------------------------------------------------------------------- 5.1 Can I do multi-threading with DBI? As of the current date of this FAQ ( see top of page ), 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: http://www.hermetica.com/technologia/oracle/oci/orathreads.tar.gz ---------------------------------------------------------------------------- 5.2 How do I handle BLOB data with DBI? To be written. ---------------------------------------------------------------------------- 5.3 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" ); ---------------------------------------------------------------------------- 5.4 How can I get return values from stored procedures with DBI? Contributed by Jeff Urlwin $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; Remember to perform error checking, though! ---------------------------------------------------------------------------- 5.5 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. ---------------------------------------------------------------------------- 5.6 How can I commit or rollback a statement with DBI? To be written. ---------------------------------------------------------------------------- 5.7 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. ---------------------------------------------------------------------------- 5.8 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. ---------------------------------------------------------------------------- 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. The present author has no knowledge as to the quality of these services. The links are included for reference purposes only. ---------------------------------------------------------------------------- Commercial Support The 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: http://www.perl.co.uk/tpc for more details. ---------------------------------------------------------------------------- Training No training programs are known at this time. ---------------------------------------------------------------------------- Other References In this section, we present some miscellaneous WWW links that may be of some interest to DBI users. These are not verified and may result in unknown sites or missing documents. http://www-ccs.cs.umass.edu/db.html http://www.odmg.org/odmg93/updates_dbarry.html http://www.jcc.com/sql_stnd.html ---------------------------------------------------------------------------- AUTHOR Alligator Descartes ---------------------------------------------------------------------------- Reproduced here by permission from Alligator Descartes Hermetica ---------------------------------------------------------------------------- 13. PostgreSQL Management Tools 13.1. PGACCESS - A GUI Tool for PostgreSQL Management 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 This is what the home page of pgaccess says: PgAccess - a Tcl/Tk interface to PostgreSQL --------------------------------------------------------------------------- Latest version of PgAccess is 0.63 , 4 December 1997 I think that there were some problems loading libpgtcl library. I invite you to read a special section concerning libpgtcl What does PgAccess now! Here are some images from 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 - NEW !!! 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 On the TODO list! - table design (add new fields, renaming, etc.) - function definition - report generator - basic scripting If you have any comment, suggestion for improvements, please feel free to e-mail to : teo@flex.ro --------------------------------------------------------------------------- More information about libgtcl Also, you will need the PostgreSQL to Tcl interface library, lined as a Tcl/Tk 'load'-able module. It is called 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 here a version already compiled for Linux i386 systems. Just copy libpgtcl.so into your system library director (/usr/lib) and go for it. 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. However, the application should work without problems. 13.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 13.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. Also very useful for shell script­ ing in Bourne, Korn and C-shells. 13.4. MPMGR - A Database Management Tool for PostgresSQL MPMGR will provide a graphical management interface for PostgresSQL. You can find it at · · Email: keidav@whidbey.com · in file tcl_syb/wisql.html · · Email: de@ucolick.org 14. 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 switch box to select the host. This saves space and you eliminate monitor(200 US dollars), keyboard(60 dollars) and the mouse(50 dollars) and also avoid lot of clutter. Please check out these sites: · Network Technologies Inc (120 dollars/PC 8 ports) which lists · Scene Double Inc, England · Cybex corporation · Raritan Inc · RealStar Solutions Inc · Belkin Inc · DataComm Warehouse Inc Call 24 hours a day, 7 days a week at 1-800-328-2261They supply all varieties of computer hardware · 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 server process 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 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 Netscape browser (Netscape is very fast becoming the standard client). To stack up cpu boxes, buy $ 15 floor-to-ceiling shelf and clamp it to the wall with several bracket clamps. Also bolt it down to floor. The size of the shelf is such that it just fits the computer. Place Intel boxes such that the side is butting against the wall and the front and rear (serial ports, network port, power connections) are easily accessible. Follow rules of Ergonomics, the shelf should have enough gap on both sides and there should be enough gap between many tower shelves. Bundle the wires neatly. Put vertical steel strips so that boxes do not fall off during earth-quakes. Floor to ceiling shelf will fit about 30 Intel-Linux boxes. Thus a small room can fit about 10 tower shelves with 300 cpu boxes controlled 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" Tech Info * Request technical manual MAN025 Monitor-VGA * Bandwidth is 150 MHz * 1600X1200 resolution with no degradation * All connectors are female Power * 110 or 220 VAC at 50 or 60 Hz 15. Problem/Project Tracking System Application Tool for PostgreSQL This is at · 16. 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 17. PostgreSQL 4GL for web database applications - AppGEN Development System AppGEN can be downloaded from . Extract from the home page of AppGEN is given below:- 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 and would appreciate any comments or suggestions about the software. 18. Web Database Design/Implementation tool for PostgreSQL - EARP in the directory 'pub/unix/earp'. The extract from the home page of EARP is given below:- The "Easily Adjustable Response Program" (EARP) created by David Dougherty 18.1. What is EARP ? 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. 18.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. 18.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 18.4. News Flash 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, and thus will support as many versions of postgres as we have time to write the modules. The development release is expected to become public near mid-spring(97). 18.5. 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. 18.6. Some online examples As part of the ICC Help Database, the Catalog Search Page is an EARP document which runs several queries. The selection boxes are generated by the EARP program from listings in the database. As another example of what can be done using EARP... now you can look at the List of Objects in the Help Database. Creating the three interfaces for the link took me less than 15 minutes. 18.7. Where do I get it ? EARP is available via anonymous ftp from in the directory 'pub/unix/earp'. The version as of this writing is 1.3.1 Please, once you've retrieved EARP and gotten it to work, drop me a line and tell me your success or failure story. 18.8. Available Documentation All documentation has been moved to the User Docs and Tutorials index page. 18.9. A History of EARP Earp 0.1 began in Fall of 1995 as program I was working on to build a dynamically configurable web accessable guest book. At that point it was a bunch of cgi programs that all did different but useful things and were held together with SSI glue, and a little sneaky c programming. What I soon realized though is that I was doing a lot of repetitive work, and that most of what I was doing had to be run in many windows at once (netscape, emacs, shell, mail) for it to make any sense, and that debugging was quickly becoming a nightmare. At that time I was also being approached by my friend and boss Don Michaels, who was interested in automating a large hunk of our user support, and keeping a historical database of requests and responses. Soon, I had worked out the initial scheme for what is now quickly becoming our help database, only I balked at the idea of building a help database with what was at that point a very primitive set of utilities. When spring classes were occurring(96) I started it anyway, mainly out of boredom, but also because I was in a database design class and a wanted to flex a few brain muscles. After a while I had a reasonable prototype up and running, which made Don very happy as he had basically given up on the idea of anyone every really creating a help database for him. (The prototype is still running on one of my servers...(june96)) The prototype did some very interesting things, but by april I was again getting discouraged... Everytime I wanted to change something, I had to go through a lengthy process of recompilation, or find an entry in a text file full of distractions. Also, there was no way for me to use the building block idea which is so useful in EARP... I did a lot of huge cutting and pasting. About the time that classes where ending I had again given up on the current scheme of things, and decided that what I needed was a better set of tools for what I was doing. Additionally, I also wanted to make my prototype work on top of a REAL relational database, and I wasn't cherishing the idea of reworking all those hard coded accesses, links, and output methods. I had a break for a short while, if you want to call it that. We sponsored the SUNY CIT Conference and I was so busy for about a week and a half that I got distanced from most of what I had written for the prototype help database, except the ideas I had had when I wrote the initial series of utilities, and what my biggest peeves were about the current state of things. Shortly after the conference, I began the prototype for the current version of EARP(may96), using the postgreSQL database as my relational backend. By the middle of June, the prototype had evolved into a fairly nice integrated suite of tool prototypes, with the primary advantage that they all ran over html, and stored their initialization information in the database. Most of the second half of june was spent debugging and working out the kinks in the code, and playing with the interface.( within those two weeks I accessed our web server over 5000 times.) By the end of June I had most of the major bugs blasted out of EARP, and a large enough number of objects in the "new" help database to officially announce it to our help support staff. Incidentally, I also kept a journal during the development of EARP, and myself and Don Michaels are presenting a paper describing the Help Database at the Chicago ACM/SIGUCCS conference in September of this year. 19. WWW Web interface for PostgresSQL - DBENGINE dbengine a plug 'n play Web interface for PostgreSQL created by Ingo Ciechowski The extract from the home page of dbengine is given below:- dbengine [CGI-Forum Webring] a plug 'n play Web interface for Postgres95 Version 0.82 alpha Documentation as of 08/11/97 Written by Ingo Ciechowski --------------------------------------------------------------------------- About dbengine dbengine is an interface between the WWW and Postgres95 which provides simple access to any existing database within just a few minutes. This little Perl program was born after I've tried quite a lot of already available packages like AppGen, PHP-FI and more. So why did I kind of re-invent the wheel ? Well, PHP-FI 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. That was the point when I started to feel more familiar with a small Perl applet of my own... and now my dbengine became a tool that I think at is ready to be shared with others. 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. Screenshots * Tablelist view with connected databases (104k) * Record view with related record list out of seperate table (100k) 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! more information... If you're interested in closer information about dbengine, use these links: * how to install dbengine * how to configure the package * working with dbengine * description database * template files If you need any additional information, please feel free to send me an E-Mail . And of course there's still the well documented Perl source code that could help you to find your way ;-) --------------------------------------------------------------------------- last update of this page: 08/11/97 --------------------------------------------------------------------------- 20. 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 - The extract from the home page of NeoWebScript is given below:- 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. NeoWebScript 2.2 just released! On June 24, 1997, NeoSoft released NeoWebScript 2.2, integrating it with the new Apache 1.2.0 server. If you're on a webserver that has NeoWebScript installed and you would like to started with it, we have a lot of User Info available. Our New User FAQ has the basic answers to get you started. The Tutorials guide you through learning the language, while the Demos give you prebuilt applications you can download and modify. Commands and Variables are the complete language references, and Troubleshooting contains hints and tips to help you get past any problems. 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. Hey, wait a minute you ask, how much do you want for all this great software, huh? 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 the gist is we'd like a whopping $ 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 42 % of the 1,044,163 sites polled by the May 1997 Netcraft Web Server survey. The next largest entry were the various Microsoft servers, reporting in with slightly over 16 %, or a difference of over 270,000 servers. Tcl/Tk is the powerful, free, cross-platform scripting language developed by Dr. John Ousterhout, now a Sun Distinguished Engineer. 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." With a developer community of over 500,000 worldwide, and thousands of commercial applications, Sun has just announced a new business group called SunScript, to support this community with an integrated development environment and to develop a suite of products to link Tcl to the Web and Java. 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 21. HEITML server side extension of HTML and a 4GL language for Post­ greSQL 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 (version 1.1.1, 1.1.3, or 1.2.4) 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.) New features in version 1.2 are - - - Component Libraries for Database Search Forms, opening and closing hierachical menus, and email forms - - - Session Mode has been re-designed and enhanced to keep all variables (including the entire heap) between pages. This means data of any size can be kept within a session. This opens up the opportunity for a wider range of new applications, e.g. storing complete query results in session memory. - - - Installation instructions, documentation and example libraries have been significantly improved, a Tutorial has been added - - - Tags to execute shell commands and send emails have been added - - - Pretty Printing and debugging support. heitml shows your source code in color in your browser and marks errors in an intuitive way. In the case of runtime errors, all internal data structures are displayed in the browser marking and preserving the original source code positions. - - - Various new server variables and built-in functions have been added - - - In production mode heitml now collects complete information on errors that occurred while people were accessing your site. This is what the home page of the heitml says - 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. heitml has so many features and uses it is impossible to describe it in a single Web Page. For that reason we have set up this Web Site in a manner that allows you to obtain a simple product "overview", or to delve as deeply as you want into the "nuts and bolts" of the language. Whichever manner you choose, we think you'll find that heitml has a lot to offer, and we hope you'll agree that it truly "takes the World Wide Web to a Higher Level!" The menu on the left-hand side of the screen will help you navigate our Web Site in an organized and methodical manner, but you can also use our Quick Menu to instantly jump to any page with a single mouse- click. If you're a first-time visitor to this Site, we suggest that you check out the heitml Interactive Guestbook for a truly impressive demonstration of how heitml can make your Web Pages more Interactive. If you sign our Guestbook, you can leave comments or tell us about your favorite Web Site using HTML formatting commands. It's like creating your own private Web Page and seeing it published immediately! The heitml Features section provides a Quick Summary of Features and Benefits, as well as Pages that are tailored to address the specific needs and questions of Designers and Programmers Our Language Guide provides an on-line tutorial that demonstrates in a practical manner some of the ways you can use heitml to develop, enhance and simplify your Web Pages and Applications. The Language Reference is for those looking for specific information regarding the syntax, structure and use of the various language elements. However, it would be a good idea for everyone to read the General Design page, which provides an overview of the specific kinds of problems heitml is designed to solve. Naturally, you'll want to know whether heitml runs on the specifc Operating System, Web Server, or SQL database software you're currently using, and you'll find all that information in our Supported Platforms section. Finally, we invite you to Download a trial copy of the program for use on your own system. We know you'll appreciate this "try before you buy policy", and we look forward to any feedback you'd like to give us. 22. PHP/FI Server-side html-embedded scripting language for Post­ greSQL WWW Interface Tool Professional Home Pages (PHP) Questions e-mail to : rasmus@lerdorf.on.ca The extract from the home page of PHP/FI is given below:- PHP/FI 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/FI is not browser-dependant. JavaScript is a client-side html-embedded language while PHP/FI is a server-side language. PHP/FI 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/FI. 22.1. Major Features Standard CGI, FastCGI and Apache module Support As a standard CGI program, PHP/FI can be installed on any Unix machine running any Unix web server. With support for the new FastCGI standard, PHP/FI can take advantage of the speed improvements gained through this mechanism. As an Apache module, PHP/FI becomes an extremely powerful and lightning fast alternative to CGI programmimg. · Access Logging With the access logging capabilities of PHP/FI, 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/FI 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/FI 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/FI can be used to create customized HTTP-based authentication mechanisms for the Apache web server. · Variables, Arrays, Associative Arrays PHP/FI 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/FI 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/FI 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/FI 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/FI 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. 22.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. PHP/FI Version 2.0 22.3. Brief History PHP began life as a simple little cgi wrapper written in Perl. I wrote it in an afternoon during a period between contracts when I needed a quick tool to get an idea of who was reading my online resume. It was never intended to go beyond my own private use. The web server where I had my resume was extremely overloaded and had constant problems forking processes. I rewrote the Perl wrapper in C to get rid of the considerable overhead of having to fork Perl each time my resume was accessed. Eventually other people on the same web server came across my wrapper and asked if they could use it. Then, as inevitably happens, they started asking for more features. I added more features and finally put together a semi-complete distribution along with documentation, a mailing-list and a FAQ. The name of this first package was Personal Home Page Tools, which later became Personal Home Page Construction Kit. At the same time I started playing with databases and wrote a tool 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. When I build the package without any access logging or access restriction support, I call my binary FI. When I build with these options, I call it PHP. 22.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. 22.5. A simple example Suppose you have a form:
Your display.html file could then contain something like: < ?echo "Hi $ name, you are $ age years old! " > It's that simple! PHP/FI automatically creates a variable for each form input field in your form. You can then use these variables in the ACTION URL file. The next step once you have figured out how to use variables is to start playing with some logical flow tags in your pages. For example, if you wanted to display different messages based on something the user inputs, you would use if/else logic. In our above example, we can display different things based on the age the user entered by changing our display.html to: 50); echo "Hi $name, you are ancient!

"; elseif($age>30); echo "Hi $name, you are very old!

"; else; echo "Hi $name."; endif; > PHP/FI provides a very powerful scripting language which will do much more than what the above simple example demonstrates. See the section on the PHP/FI Script Language for more information. You can also use PHP/FI to configure who is allowed to access your pages. This is done using a built-in configuration screen. With this you could for example specify that only people from certain domains would be allowed to see your pages, or you could create a rule which would password protect certain pages. See the Access Control section for more details. PHP/FI is also capable of receiving file uploads from any RFC-1867 compliant web browser. This feature lets people upload both text and binary files. With PHP/FI's access control and logical functions, you have full control over who is allowed to upload and what is to be done with the file once it has been uploaded. See the File Upload section for more details. PHP/FI has support for the PostgreSQL database package. It supports embedded SQL queries in your .HTML files. See the section on PostgreSQL Support for more information. PHP/FI also has support for the mysql database package. It supports embedded SQL queries in your .HTML files. See the section on mysql Support for more information. 22.6. CGI Redirection Apache 1.0.x Notes A good way to run PHP/FI is by using a cgi redirection module with the Apache server. Please note that you do not need to worry about redirection modules if you are using the Apache module version of PHP/FI. There are two of these redirection modules available. One is developed by Dave Andersen angio@aros.net and it is available at ftp://ftp.aros.net/pub/util/apache/mod_cgi_redirect.c and the other comes bundled with Apache and is called mod_actions.c. The modules are extremely similar. They differ slightly in their usage. Both have been tested and both work with PHP/FI. One large caveat at the time of this writing (Apr.20/96) is that the current official Apache release (1.0.5) has a severe limitation which prevents cgi redirected requests from having any post-method data associated with them. I have tracked this down and fixed it in my version of Apache, and there is an official patch available in the File Archives on the PHP Home Page. A second rather large caveat with Apache 1.0.x is that it does not align double types correctly on most architectures. You find find yourself getting strange bus errors from your httpd when using mod_php, either upgrade to Apache 1.1 or edit the alloc.c Apache source file. In this file you will find the following piece of code: union align { /* Types which are likely to have the longest RELEVANT alignment * restrictions... we don't do much with doubles. */ char *cp; void (*f)(); long l; FILE *fp; }; You will need to add a double to this line and recompile your Apache server. The correct block of code is: union align { /* Types which are likely to have the longest RELEVANT alignment * restrictions... we don't do much with doubles. */ char *cp; void (*f)(); long l; FILE *fp; double d; }; Check the Apache documentation on how to add a module. Generally you add the module name to a file called Configuration. The line to be added if you want to use the mod_actions module is: Module action_module mod_actions.o If you are using the mod_cgi_redirect.c module add this line: Module cgi_redirect_module mod_cgi_redirect.o Then compile your httpd and install it. To configure the cgi redirection you need to either create a new mime type in your mime.types file or you can use the AddType command in your srm.conf file to add the mime type. The mime type to be added should be something like this: application/x-httpd-php phtml If you are using the mod_actions.c module you need to add the following line to your srm.conf file: Action application/x-httpd-php /cgi-bin/php.cgi If you are using mod_cgi_redirect.c you should add this line to srm.conf: CgiRedirect application/x-httpd-php /cgi-bin/php.cgi Don't try to use both mod_actions.c and mod_cgi_redirect.c at the same time. Once you have one of these cgi redirection modules installed and configured correctly, you will be able to specify that you want a file parsed by php/fi simply by making the file's extension .phtml. Furthermore, if you add index.phtml to your DirectoryIndex configuration line in your srm.conf file then the top-level page in a directory will be automatically parsed by php if your index file is called index.phtml. Netscape HTTPD You can automatically redirect requests for files with a given extension to be handled by PHP/FI by using the Netscape Server CGI Redirection module. This module is available in the File Archives on the PHP/FI Home Page. The README in the package explicitly explains how to configure it for use with PHP/FI. NCSA HTTPD NCSA does not currently support modules, so in order to do cgi redirection with this server you need to modify your server source code. A patch to do this with NCSA 1.5 is available in the PHP/FI file archives. 22.7. Running PHP/FI from the command line If you build the CGI version of PHP/FI, you can use it from the command line simply typing: php.cgi filename where filename is the file you want to parse. You can also create standalone PHP/FI scripts by making the first line of your script look something like: #!/usr/local/bin/php.cgi -q The "-q" suppresses the printing of the HTTP headers. You can leave off this option if you like. 23. Python Interface for PostgreSQL PyGres95 is a python interface for the PostgreSQL. See the readme file at Package is available from The extract from the home page of PyGres95 is given below:- PyGres - v1.0b : PostgreSQL module for Python PyGres95, version 1.0b A Python interface for PostgreSQL database. Written by Pascal Andre, andre@chimay.via.ecp.fr PostgreSQL is a database system derived from Postgres4.2. It conforms to (most of) ANSI SQL and offer many interesting possibilities (C dynamic linking for functions or type definition, time travel, ...). This package is copyrighted by the Regents of the University of California, and is freely distributable. Python is a interpretated programming langage. It is object oriented, simple to use (light syntax, simple and straighforward statements), and has many extensions for building GUIs, interfacing with WWW, ... An "intelligent" web browser (HotJava like) is currently under development (november 1995), and this should open programmers many doors. Python is copyrighted by Stichting Mathematisch Centrum, Amsterdam, The Netherlands, and is freely distributable. PyGres95 is a python module that interfaces PostgreSQL database. It embeds PostgreSQL query library to allow an easy use of powerful PostgreSQL features cooperatively with all the other python modules. It has been developed on a Linux 1.3/ELF system, but have been tested on a Solaris 2.4 platform. Anyway, it should work on any platform where python and postgreSQL are available. 23.1. Where to get PyGres ? The home sites of the differents packages are: · Python : · PostgreSQL : · PyGres95 : You should anyway try to find some mirror site closer of your site. Refer to the information sources to find these sites. PyGres95 should reside in the contrib directories of Python and PostgreSQL sites. 23.2. Information and support If you need information about these packages please check their web sites: · Python : · PostgreSQL : · PyGres95 : For support : · Python : newsgroup comp.lang.python · PostgreSQL : mailing list (see package documentation for information) · PyGres95 : contact me andre@via.ecp.fr for bug reports, ideas, remarks I will try to answer as long as my free time allow me to do that. 24. Gateway between PostgreSQL and the WWW - WDB-P95 WDB-P95 - A Web interface to PostgreSQL Databases. It is at The extract from the home page of WDB-P95 is given below:- Version 1.4b2 beta - Created by J. Douglas Dunlop About wdb-p95 This is a modified version of wdb-1.3a2 which provides a gateway to a the WWW for PostgreSQL. This version also requires a Browser that is capable of handling HTML Tables for the tabular output. This is not required by the original wdb and can be fairly easily reverted. (I only wanted tables because the < pre > stuff just didn't agree with me!) You can try out my CASI Tape and Image Query. You can have a peek at the Form Definition File (FDF) that I used to create the CASI Tape and Image Query too, which includes a JOIN of 2 tables. This release contains all files necessary to install and run WDB-P95 as an interface to your PostgreSQL databases. To port this system to other database should be relatively easy - provided that it supports standard SQL and has a Perl interface. 24.1. Does the PostgreSQL server,pgperl, and httpd have to be on the same host? No - the PostgreSQL server does not have to be on the same host. As WDB-P95 is called by the http daemon, they have to be on the same host. - And as WDB-P95 was written to use Pg.pm - pgperl has to be on the same host too. Pgperl was written using the libpq library, so it will be able to access any PostgreSQL server anywhere in the net, just like any other PostgreSQL client. As illustrated below {WWW Client (Netscape)} => {HTTP Server (NCSA's http) + WDB-P95 + pgperl + libpq}=> {PostgreSQL server} Curly brackets () represent machines. Each machine can be of a different type : NT, SUN, HP, ... but you need the libpq interface library for the machine type where you plan to use WDB-P95, as you need it to compile pgperl. (The system was designed to use HTML tables so a recent WWW client is best) 24.2. New Version New versions of the software and the above pages are always available from the WDB-P95 Home page. For questions or to join Mailing lists contact dunlop@eol.ists.ca 25. C" language Interface for PostgreSQL Included in distribution and is called 'libpq'. Similar to Oracle OCI, Sybase DB-lib, Informix CLI libraries. 26. C++" language Interface for PostgreSQL Included in distribution and is called 'libpq++'. 27. ESQL/C for PostgreSQL Embedded C Pre-compiler for PostgreSQL ESQL/C like Oracle Pro*C, Informix ESQL/C: · · Email : linus@epact.se The PostgreSQL ESQL/C is an SQL application-programming interface (API) enables the C programmer to create custom applications with database-management capabilities. The PostgreSQL ESQL/C allows you to use a third-generation language with which you are familiar and still take advantage of the Structured Query Language (SQL). ESQL/C consists of the following pieces of software: · The ESQL/C libraries of C functions provide access to the database server. · The ESQL/C header files provide definitions for the data structures, constants, and macros useful to the ESQL/C program. · The ESQL/C preprocessor, is a source-code preprocessor that converts a C file containing SQL statements into an executable file. 28. BitWise Operators for PostgreSQL Bitwise operators was written by Nicolas Moldavsky nico@overnet.com.ar "C" functions that implement bitwise operators (AND, OR, XOR, bit complement) on pgsql. If anyone would like to use them, can get them by anonymous FTP from · There included is a Makefile that works fine on Linux. 29. Japanese Kanji Code for PostgreSQL Very useful for Japanese people. It is at the following site 30. PostgreSQL Port to Windows 95/Windows NT Port to Windows 95/Windows NT is underway. Porting is being done using gcc, gmake for Win NT/95. To compile source code on win32 gnu- win32 program is used. GNU gcc is available for win32. Check this site - · At this site and get the file cdk.exe (self-extractor file for gnu- win32) Porting can also be done using the following "Unix-Emulator on NT" tool from · 31. Mailing Lists and Newsgroups 31.1. Newsgroups There is newsgroup for PostgreSQL at news.postgresql.org Please follow these steps to subscribe 1. Choose Window | Netscape News 2. Choose File | Open News Host 3. Type news.postgresql.org in the edit box. 4. The name of the newsgroup is comp.databases.postgresql.questions. To add right-click on news.postgresql.org, and choose Add Newsgroup. Then type the newsgroup into the edit box. The newsgroup will be added to the list in the left hand pane. 5. Newsgroups will be listed in the left hand pane. Any messages in the selected newsgroup will appear in the right hand pane. 31.2. Get a Free e-mail account Check out the free deals offered - get free e-mail accounts from · In Yahoo click on e-mail · In Lycos click on new e-mail accounts · In hotmail click on new e-mail accounts Subscribe to PostgreSQL mailing list and Yahoo has additional feature of creating a seperate folder for PostgreSQL e-mails, so that your regular e-mail is not cluttered. Select menu Email- > Options- > Filters and pick seperate folder for email. With this e-mail account you can access mail from anywhere in the world as long as you have access to a web page. If you have any other e-mail, you can use "Mail Filters" to receive automatically the PostgreSQL mails into a seperate folder. This way it will be better organised and you avoid mail cluttering. 31.3. English Mailing List See the Mailing Lists Item on the main web page at : · Email questions to: pgsql-questions@postgresql.org · Developers pgsql-hackers@postgresql.org · Port specific questions pgsql-ports@postgresql.org · Documentation questions pgsql-docs@postgresql.org You will get the answers/replies back by e-mail in less than a day!! You can also subscribe to mailing lists. See also the section 'Get a Free e-mail account' above. To subscribe or unsubscribe from the list, send mail to · pgsql-questions-request@postgresql.org · pgsql-hackers-request@postgresql.org · pgsql-ports-request@postgresql.org · pgsql-docs-request@postgresql.org The body of the message should contain the single line subscribe (or) unsubscribe 31.4. Archive of Mailing List Also mailing lists are archived in html format at the following location - · directory is /pub/majordomo 31.5. Spanish Mailing List Now there is an "unofficial" list of postgreSQL in Spanish. See also the section 'Free Account to Organise your PostgreSQL e-mails' above. To subscribe the user has to send a message to: · majordomo@tlali.iztacala.unam.mx The body of the message should contain the single line: inscripcion pgsql-ayuda 32. Documentation and Reference Books 32.1. User Guides and Manuals The following are included in the PostgreSQL distribution in the postscript format and unix man-pages. If you have access to internet, you can find the documents listed below at · "User Guide" for PostgreSQL · "Implementation Guide" detailing database internals of PostgreSQL. · Online manuals. · Online manuals in HTML formats. · Also manuals in Postscript format for printing hard copies. 32.2. Online Documentation · Listing and description of default data types and operators Will be a part of PSQL command in the next release 6.3. Already completed. · Listing of supported SQL keyw