IMP Database Installation Guide
Copyright 1999 Ivan E. Moore II <rkrusty@tdyc.com>
Copyright 1999 Mike Hardy <mikeh@spark.com>

This code is licensed under the GNU Public License.
See the file COPYING in this directory.

--------------------
Purpose of this file
--------------------

What this file will hopefully do for you is make setting up
your database for use with IMP much easier.  The goal
is not to help you setup your database for general use, just
how to setup the tables and users for IMP.


-------------------- 
Requirements for IMP 
--------------------

IMP Currently supports 4 databases.

   MySql
   PostgreSql
   Oracle
   Sybase
   Informix

MySql was the original database supported by IMP and should at all
times (most likely) work for sure.  PostgreSql I can verify works
like a champ.  The others are more recent additions or those that
have less support currently.  For this reason (and the reason
that I cannot verify personally that they work or have ever
configured them) they won't be mentioned much in this file.
No one using Informix has contacted us for a while, but Oracle and 
Sybase are both currently used and should work.

You will need to have your database preconfigured and working
on your system before you even get to this stage.  For help
with this please consult your database specific help files.


--------------------------
Methods of Installation
--------------------------

There are 2 basic methods for configuring your database. The
first is manually doing it yourself. This is the method
that will make sure that things are setup as you can see 
step by step that things are being configured properly.

The other method is to use one of the scripts that have been
created to automatically configure your database.  These
scripts should work but there are times when things may not
work the way they are supposed to.  Also, when using scripts
you need to be aware that they may not be setup exactly
for your system so you need to verify them to make sure things
are correct for your particular install before using them.


=-=-=-=-=-=-=-=-=
MANUAL INSTALL:
=-=-=-=-=-=-=-=-=

For the 2.2.0 version of IMP you will need to setup 2 tables. Here
is a breakdown of the tables and their elements:

Table 1:

   imp_pref (
       user         text
       sig          text
       fullname     text
       replyto      text
       lang         varchar(30) 
   )

   imp_addr (
       user         text
       address      text
       nickname     text
       fullname     text
   )


I kind of broke them down as they would go into the database...ie, the
name then what it is...(example:  user is a text field).

The database name itself needs to be "horde" and should already be created
as you should have already installed the Horde module.

Next you'll need to create a user or give a user access to this
database.  This user will need pretty much full control over this
database.  The username we use for the most part is impmgr or in
the case of PostgreSql it's the name of the user who runs your
web server.  (nobody on most systems, www-data on Debian)  Here
are a few configuration tips for MySql and PostGreSql:

MYSQL:

INSERT INTO user ( host, user, password )
   VALUES (
      'localhost',
      'impmgr',
      password( '' )
      );

INSERT INTO db (
      host, db, user,
         Select_priv, Insert_priv, Update_priv, Delete_priv,
         Create_priv, Drop_priv )
      VALUES (
      'localhost',
      'horde',
      'impmgr',
      'Y', 'Y', 'Y', 'Y',
      'Y', 'Y'
        );

This will setup a user called impmgr with no password and
give them access to the imp database.

POSTGRESQL:

GRANT SELECT, INSERT, UPDATE ON imp_pref, imp_addr, imp_sessions TO nobody;

This will give the user nobody access to these tables (imp_pref, etc...).  
Note, with PostgreSql you do not have to add a user into the database as
PostgreSql uses the system user of nobody (or whoever runs your web server)
as the form of authentication into the database.

Also, you need to make sure you allow TCP connections into your 
database.  PostgreSql has a switch in one of it's configuration files
(postmaster.init or something like that) that needs to be set to yes:

PGALLOWTCPIP=yes

Without this set to yes IMP won't be able to talk to your database and
you'll get tons of errors. :)

That's about it.  You need to restart your database just to make sure
everything starts up the way it should.

=-=-=-=-=-=-=-=-=
SCRIPTED INSTALL:
=-=-=-=-=-=-=-=-=

(NOTE: Scripts are located in imp/config/scripts)

The easier way of configuring your database is to use one of the
scripts that have been made available to you.  Here is a breakdown
of how to use each script.

MySql:

MySql's script is called mysql_create.sql.  The method you would call
it is by first logging into an account that has full access to the
database or by using a switch to call that user.  I'll show both
methods.

Before using any of these scripts, please look over them to make
sure that any system specific settings (or personal choices) are
set to your desired settings...ie usernames, etc...

MySql: 

 su - root

   mysql < mysql_create.sql
     or
   mysql -password=root'spasswordformysql < mysql_create.sql

 or (without changing to root)

   mysql -user=username < mysql_create.sql
     or
   mysql -user=username -password=root'spasswordformysql < mysql_create.sql


That's it..restart MySql and try it out

PostgreSql:

  su - postgres  (or whoever your database runs as..usually postgres)

  psql template1 < pgsql_create.sql

That's it, restart PostgreSql and try it out.

Oracle:

  Run sqlplus.  Login to it.  then run @oracle_create.sql
    (please note you may not need the .sql at the end of that)

That should be it.  Restart Oracle just to be sure and try it.

Informix:

  Log into dbaccess and run ifmx_create.sql

Restart Informix and try it out

Sybase:

  First you'll need to create the database. From isql run:

    create database horde

  Next you should (recommended) create a login to use with this database.
  The isql command for this is:

    sp_addlogin <username> <password>

  Next you need to change the ownership of the database to this new user. 
  The isql command for this is:

    sp_changedbowner <username>

  After that you just need to setup your tables within the database.  To
  do that just run this command from the command line:

    isql -i sybase_create.sql -U<username> -P<password>

=-=-=-=
Notes:
=-=-=-=

     This is by far no complete HOWTO.  This is just a compiled list
of what people have contributed so far.  Some of this is from my
personal experience (MySql and PostgreSql).  If you have tips, ideas,
suggestions or anything else that you think could help others in
setting up their database for use with IMP please let me know and
I'll include them.  (or contribute to IMP yourself and change this
file on your own!)
