#********************************************************
# FILE NAME:     odbc_instructions
#                : How To Port databases for Web+Mall 
#                  to ODBC
#                  on Unix/Linux/Solaris ... 
#
# CREATED BY:    TalentSoft Web+ Unix Team
# CREATED ON:    3/18/1999
#
# DESCRIPTION:
# Documentation:  How To Port databases for Web+Mall
# to ODBC
# on Unix/Linux/Solaris ... 
#
# NOTE:
#
# COMMENT: Adapted from Web+ install bundle by EJG 3/18/99
#
#******************************************************


TalentSoft Web+Mall for Sun Solaris/Linux Install odbc_instructions 
v4.0 Mar. 1999
===============
    TalentSoft, Talent Information Management.
    Tech Support: 612-338-8900
	email: support@talentsoft.com
	web:   http://www.talentsoft.com/scripts/webpconference/frameset.wml


This document describes the process through which one would port
the TalentSoft Web+Mall 4.5 databases to a DBMS other than postgreSQL or MySQL
and connect to them using ODBC.  This file has not been updated for Web+Shop
4.6.1 and may no longer apply.  It is included as a reference and has not
been tested with Web+Shop 4.6.1


1. Introduction
===============
1.1. Assumptions
This document assumes that you have successfully installed  web+ 4.5 and you 
have the proper permissions to carry out all of the commands mentioned herein. 

1.2. Why do you need to install a database
   Web+Mall 4.5 has built-in support for accessing mysql database systems. 
It also can support a lot of other database systems through an ODBC
connection such as OpenLink. Since Web+Mall 4.5 ships with two databases,
wpmall_cfg, the configuration database, and wpmall_store, the stores database,
you must install and configure them.


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 three directories under webpmall45/database,  one is mysql, one is
postgres, and the other is odbc. The files under it are for the corresponding
database systems. Under each such directory, there are files for setting up 
each type of database, for example, the mysql and postgresql directory contain 
shell scripts and SQL files, and the odbc directory contains Microsoft Access
.mdb files



3. Database porting

Since there are many possible database systems, it is impossible for us to give detailed instructions for every one. This file can only serve as a general 
guideline. 

3.1 MS Access 97 export

If you have a computer running Windows NT/98/95, with MS Access 97 or higher, and with ODBC access to the target DBMS, then you may be able to use this method.

A. Prepare the databases on the target system:
	Web+Mall 4.5 needs two databases, one for configuration 
	information, and one for actual store content. The wpmall_cfg
	database does not need to be very large, 1 MB is more than 
	enough. The wpmall_store databse is much larger. The example
	store that ships with the shop has 47 products, and takes up
	over 5 MB as an MS Access .mdb file. A reasonable starting value
	for database size may be around 10 MB. Once you've created the
	two empty databases, it's time to populate them.

B. Set up temporary ODBC datasources for data export
	The computer with MS Access will need to be able to create and
	populate tables in the databases on the taget system. To do
	this, you'll have to set up ODBC datasources. We recommend
	creating two system datasources, that use the OBDC driver for
	your target DBMS. Make sure that your MS Access computer has
	the appropriate permissions to create tables.

C. Create and Populate Tables
	On the MS Access computer, open the files wpmall_cfg.mdb
	and wpmall_store.mdb. For each table in each database, 
	perform the following steps: 
		-Highlight the table, and right-click it
		-Select the option "Save As/Export"
		-Select the option "To an external file
			or database" and click "OK"
		-In the "Save Table As" dialog box that comes up,
			find the "Save as Type" drop-down box
		-Select the "ODBC Databases ()" option
		-Click "OK"
		-Select the ODBC datasource to export the table to
			
3.2 Direct SQL import

If you are unable to use MS Access export to create your databases, you 	may be able to import the data directly using SQL. Examine the files
	database/mysql/wpmall_cfg.sql
	database/mysql/wpmall_store.sql
or
	database/postgresql/wpmall_cfg.pg.orig
	database/postgresql/wpmall_store.pg.orig

Check the syntax of the CREATE TABLE commands, and make sure that the
datatypes used are compatible with your target DBMS. Consult your
DBMS documentation for more details.

The exact syntax for creating databases and running SQL scripts for
your particular DBMS will probably vary, but we can provide the 
commands used by MySQL and postgreSQL as examples.

for MySQL:

	mysqladmin create wpmall_cfg
	mysql wpmall_cfg < database/mysql/wpmall_cfg.sql
	mysqladmin create wpmall_store
	mysql wpmall_store < database/mysql/wpmall_store.sql

for postgreSQL:

	createdb wpmall_cfg
	psql wpmall_cfg < database/postgresql/wpmall_cfg.pg.orig
	createdb wpmall_store
	psql wpmall_store < database/postgresql/wpmall_store.pg.orig


We have successfully used the postgreSQL script to populate
IBM db2 databases on AIX and Linux, making only minor modifications
to the SQL.

4.0 Configuring ODBC on the Web+ Server

The machine running Web+ will need to be configured to see the newly-created
Web+Shop databses. If you are using OpenLink's ODBC then you will have to edit
the odbc.ini file to include the datasources wpshop_cfg and wpshop_store. The
exact setup will vary, depending on the DBMS you use. As a guide, we have included a sample obdc.ini at the end of this file. If you are using another ODBC system, consult the manufacturer's documentation.

4.1 Configuring Web+ to recognize ODBC datasources:

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: wpmall_cfg, database: wpmall_cfg, type: ODBC.

For ODBC datasources, the 'host' and 'port' fields are not needed.

"user' and 'password' fields may be required, depending on your database.


5.0 Web+Mall .wml  Script Modifications

At this time, the only place in Web+Mall 4.5 's .wml scripts where non-portable
SQL has been used is in admin/orders.wml. Check around lines 53 and 77, where
the values of the variable DBVer is checked. Since we're not using MySQL or
postgres, the script will default to the third option, which uses the datediff
function specific to MS Access. These lines will have to be modified to use the
equivalent function in your DBMS.





APPENDIX 1 Sample odbc.ini file





;
;  odbc.ini
;
;  $Id: odbc_instructions,v 1.2 2001/06/08 18:56:27 jime Exp $
;
;  OpenLink Systemwide ODBC parameters
;
;  (C)Copyright 1996 OpenLink Software.
;  All Rights Reserved.
;
;  The copyright above and this notice must be preserved in all
;  copies of this source code.  The copyright above does not
;  evidence any actual or intended publication of this source code.
;
;  This is unpublished proprietary trade secret of OpenLink Software.
;  This source code may not be copied, disclosed, distributed, demonstrated
;  or licensed except as authorized by OpenLink Software.
;

[ODBC Data Sources]
Oracle=OpenLink (MT)
Informix=OpenLink (MT)
Ingres=OpenLink (MT)
wpshop_cfg (MT)
wpshop_store (MT)
;
; Global parameters
;
; The shown parameters are the default values (in seconds)
;
[UDBC]
;DebugFile	= /tmp/udbc.out		; Write client debugging output

[Communications]
ReceiveTimeout	= 120			; max. time to complete a request
BrokerTimeout	= 30			; max. time to wait for oplrqb 
RetryTimeout	= 5			; Retry time for oplrqb locating
SendSize	= 16000			; RPC send buffer size (0 = default)
ReceiveSize	= 16000			; RPC receive buffer size (0 = default)
ShowErrors	= Y			; Pass RPC errors to applications
DataEncryption	= N			; Encrypt outgoing data

;
; These values can be overruled in the connect string passed to
; SQLDriverConnect:
;
;	HOST=<server host name>		[Host]
;	SVT=<database server type>	[ServerType]
;	DATABASE=<database path>	[Database]
;	OPTIONS=<db specific opts>	[Options]
;	UID=<user name>			[UserName]
;	READONLY=<N|Y>			[ReadOnly]
;	FBS=<fetch buffer size>		[FetchBufferSize]
;       <server specific opts>		[ServerOptions]
;
; For security reasons, there is no provision to store the password
; in this file

;
; Sample Informix connection
;
[Informix]
Driver		= /usr/lib/oplodbc.so
Host		= localhost		; can be a name or a numeric address
ServerType	= Informix 7		; must correspond with oplrqb.ini
ServerOptions	=			; Not used for this ServerType
Database	= stores7		; Database to connect
Options		=			; Not used for this ServerType
ReadOnly	= No			; Yes, we want to update
FetchBufferSize = 60		

;
; Sample Ingres connection
;
[Ingres]
Driver		= /usr/lib/oplodbc.so
Host		= localhost
ServerType	= Ingres 6
Database	= odbc
UserName	= ingres
ReadOnly	= No
FetchBufferSize = 60		

[Oracle]
Driver		= /usr/lib/oplodbc.so
Host		= localhost
ServerType	= Oracle 7
Database	= ODBC
UserName	= openlink/odbc
FetchBufferSize = 60		

[wpshop_cfg]
Driver          = /usr/lib/oplodbc.so
Host            = python.goweb.com
ServerType      = SQLServer 6
Database        = wpshop_cfg
FetchBufferSize = 60

[wpshop_store]
Driver          = /usr/lib/oplodbc.so
Host            = python.goweb.com
ServerType      = SQLServer 6
Database        = wpmall_store
FetchBufferSize = 60
