=head1 NAME

OpenInteract2::Manual::AdminDatabase - Setting up databases for use with OpenInteract2

=head1 DESCRIPTION

OpenInteract2 is designed to work with one or more relational database
systems (RDBMS). Thanks to SPOPS, it can be flexible about which one
it uses. But you still need to do some initial setup work to ensure
your database is prepared.

This document describes the different procedures necessary to use
OpenInteract2 with the databases it supports. It does not cover
setting up the various RDBMS packages themselves and assumes you have
a database server up and running.

In the discussion below we use a few variables. These will, of course,
depend on your DBMS.

=over 4

=item *

C<$ADMINUSER>: A user with sufficient administrative rights to create
a database

=item *

C<$ADMINPASSWORD>: The password for C<$ADMINUSER>

=item *

C<$DBNAME>: The name you give your database.

=item *

C<$WEBUSER>: The user that is going to access this database via
OpenInteract. This user must be able to create and drop tables as well
as modify data within those tables.

=item *

C<$WEBPASSWORD>: The password for C<$WEBUSER>

=back

The following also assumes that the command-line utilities executed
(e.g., 'mysql', 'psql', 'isql') are installed and on your PATH. If
not, setup your PATH so they're accessible for executing or ask your
friendly local DBA to do this for you.

=head1 MySQL

To create a database, run the following command:

  1: $ mysqladmin --user=$ADMINUSER --password=$ADMINPASSWORD create $DBNAME

Once the database is created, ensure that the non-administrative user
you've chosen to use with OpenInteract has full access to it. The
following will create a new user with access to your database:

  1: $ mysql --user=$ADMINUSER --password=$ADMINPASSWORD $DBNAME
  2: mysql> GRANT ALL ON $DBNAME.* TO $WEBUSER@localhost 
  3: mysql> IDENTIFIED BY '$WEBPASSWORD'\g

You will probably also need to give this user permission to use the 'mysql'
database:

  1: mysql> GRANT SELECT ON mysql.* TO $WEBUSER@localhost 
  2: mysql> IDENTIFIED BY '$WEBPASSWORD'\g

Once you're done with these statements, leave the mysql shell and reload the grant tables:

  1: $ mysqladmin --user=$ADMINUSER --password=$ADMINPASSWORD reload

=head1 PostgreSQL

To create a database, run the following command as the C<postgres> (or
equivalent) user:

  1: $ createdb $DBNAME

Once you've created the database, you can create a user:

  1: $ psql $DBNAME
  2: psql> create user $WEBUSER 
  3: psql> with password '$WEBPASSWORD' nocreatedb nocreateuser\g

=head1 Sybase ASE

(coming)

=head1 Sybase ASA

(coming)

=head1 MS SQL Server

(coming)

=head1 Oracle

(coming)

=head1 COPYRIGHT

Copyright (c) 2002-2003 Chris Winters. All rights reserved.

=head1 AUTHORS

Chris Winters E<lt>chris@cwinters.comE<gt>