#********************************************************
# FILE NAME:     HOWTO_DATABASE
#                : How To Install database for Web+ application 
#                  on Unix/Linux/Solaris ... 
#
# Copyright (c) 2000 by talentsoft, inc.
# ALL RIGHTS RESERVED
#
# DESCRIPTION:
# Documentation:  How To Install databasefor Web+ applications 
# on Unix/Linux/Solaris ... 
#
# NOTE:
#
# COMMENT:
#
#******************************************************


TalentSoft Web+ Unix/Linux Install HOWTO_DATABASE
This particular document goes along with the Solaris/Linux/FreeBSD versions of 
UNIX.
v4.6 April 2000 
===============
    TalentSoft, Talent Information Management.
    Tech Support: 612-338-8900
	email: support@talentsoft.com
	web:   http://www.talentsoft.com


This document describes the process through which one would install
the TalentSoft web+ 4.6 sample database.


1. Introduction
===============
1.1. Assumptions
This document assumes that you have successfully installed  web+ 4.6 and you 
have the proper permissions to carry out all of the commands mentioned herein. 
It also assumes that you have installed one of the  following database systems:
1. mysql
2. postgresql
If you have problems with the install of these database systems, please consult 
the help files included with the webplus installation (MySQL_Install.txt and 
PostgreSQL_Install.txt) or the documentation of the database server application itself.
  

1.2. Why do you need to install a database
   Web+ 4.6 has built-in support for accessing mysql, postgresql database
systems. It also can support a lot of other database systems through an ODBC
connection such as OpenLink. Since Web+ 4.6 ships with
several example applications such as unit conversion, contact manager, etc. some of 
which need to access the example database (webpdb), before you can try these examples, you need to 
install and configure the database.  In addition, if you plan to use Web+Shop, you will need
to achieve database connectivity in order for this product to properly install and run.

1.3. Information Sources
There is a significant amount of information available on Talentsoft's WWW site
(http://www.talentsoft.com) as well as technical support for paying customers.


2. File Location
================
There are two directories in your /webplus/database,  one is mysql, the other is
postgresql, the files under it are for the corresponding database systems. Under 
each such directory, there are subdirectories for each database, for example, 
subdirectory ./example stores the installation script for  the Web+ example 
database. Currently this is the only one, but we may add more in the future.

3. Database installation
There are three steps to setting up a database for Web+ 4.6:
1. Create the database
2. Run the database installation script
3. Configure the datasource

Before you install mysql database, you need to make sure you have a mysql
database system installed, that the current user has permission to create databases, 
insert records, and that all environment variables and paths are correctly set up. The script
named install_db.sh should handle this. However if you are encountering problems getting the
webplus example database to run, you may need to check on the database configuration. After you
log into mysql as a user with rights to select, insert and update tables, you should inspect
two tables in the MySQL database. You should see entries for the user 'webplus' in the
db and user tables. If Webplus is connecting to a remote database, you should also seen entries
for webplus in the host table. If these entries are not in the appropriate tables in the MySQL database,
then the database installation script did not run correctly. You may run it again by 
running the script again. You will find it in your webplus46 installation directory under the
subdirectory database. The database installation is script is named install_db.sh. If the script continues to 
fail, you may attempt to manually install the examples database by following the instructions below. If you continue
to have problems please consult the developers forum on the web site <www.talentsoft.com>, or you can email technical support
at support@talentsoft.com.

3.1. Installing mysql database
1. create database
   The  first step is to create a database  using mysqladmin create <dbname>,
For example, to create example database:

  mysqladmin create  webpdb

2. running the SQL statement file
   The second step is to create all tables and insert all necessary records 
into these tables. All the table  creation and record insertion SQL statements
are all in the SQL file. You can execute these SQL statements by starting mysql 
client with input redirected by this file. To build  web+ example database:

   mysql webpdb </webplus/database/mysql/example/webpdb.sql

3. Configure the datasource
  The last step  is make Web+ aware of the database. To do this, open a
browser, run the Web+ Server Manager, select the "datasources" button, and
add a new datasource.  
For our example database, the datasource name is: Webplus_Examples,
database: webpdb, type: mysql; machine: localhost, unless the database is remote, in which case the host field should
contain the name of the database server;  port: 3306 in most cases, in RPM installs it is often /var/lib/mysql/mysql.sock; 
userid: webplus password: webplus; select, insert, update, delete and store procedure (SP) should all be checked.

3.2. Installing postgresql database
1. Create the database
   Create the database using createdb <dbname>. For example, to create example 
database:

  createdb webpdb

2. Run the SQL statement file
  Execute the SQL statements by starting the postgresql client with input 
redirected by this file. To build the Web+ example database:

   psql webpdb </webplus/database/postgres/example/webpdb.sql

3. Configure the datasource
  The last step  is make Web+ aware of the database. To do this, open a
browser, run the Web+ Server Manager, select the "datasources" button, and
add a new datasource.  
For our example database, the datasource name is: Webplus_Examples,
database: webpdb, type: postgresql, machine: localhost.

4. Troubleshooting
  If you follow the steps above and still can't access the database from
a Web+ script, it's most likely because the user running Web+4.0 doesn't have
permission to do that. Make sure the user (check WebpRunasUser key in 
webpsvr.conf) has permission to access the file. For postgresql, the 
WebpRunAsUser must not be root! If you still has problems, check your 
database system's version, try to upgrade to a new version.
If problems still remain, contact TalentSoft Technical Support.
