KonaKart Logo Documentation
Search
Installation Notes for Databases

Installation Notes for Databases

Defining the Database Parameters

You define the database parameters in two configuration files underneath your konakart installation directory at:


webapps\konakart\WEB-INF\classes\konakart.properties
and
webapps\konakartadmin\WEB-INF\classes\konakartadmin.properties

(Therefore, the default on Windows will be at C:\Program Files\KonaKart\webapps\konakart\WEB-INF\classes\konakart.properties).

Inside these files you will find: (the url parameter is broken into two lines for readability only - you should keep it on one line)


# ------------------------------------------------------------------
# D A T A B A S E    P R O P E R T I E S
# Database Connection Parameters Set by Installer on 3-Sep-2006
# ------------------------------------------------------------------

torque.database.default = oscommerce

torque.database.oscommerce.adapter = mysql

torque.dsfactory.oscommerce.connection.driver =com.mysql.jdbc.Driver
torque.dsfactory.oscommerce.connection.url = 
 jdbc:mysql://localhost:3306/mydb?zeroDateTimeBehavior=convertToNull
torque.dsfactory.oscommerce.connection.user = root
torque.dsfactory.oscommerce.connection.password =

-------------------------------------------------------------------

Leave the torque.database.default equal to oscommerce.

You need to set the five parameters appropriate for your environment:

  • torque.database.oscommerce.adapter (either "mysql", "oracle", "db2net", "mssql" "postgresql")
  • torque.dsfactory.oscommerce.connection.driver (All JDBC drivers for the supported databases are on the default classpath)
  • torque.dsfactory.oscommerce.connection.url (keep the value on the same line after the equals sign)
  • torque.dsfactory.oscommerce.connection.user
  • torque.dsfactory.oscommerce.connection.password

Notes for DB2 and Oracle

In addition to the settings above, you have to set the validationQuery for DB2 and Oracle slightly differently to the others, as follows. This section is defined just below the database parameter definitions in the two properties files (konakart.properties and konakartadmin.properties):


# The SQL query that will be used to validate connections from this
# pool before returning them to the caller. If specified, this 
# query MUST be an SQL SELECT statement that returns at least one
# row.
#
# Recommended settings:
#
# for MySQL/PostgreSQL/MS SQL use: SELECT 1
# for DB2                     use: SELECT 1 FROM sysibm.sysdummy1
# for Oracle                  use: SELECT 1 from dual

torque.dsfactory.oscommerce.pool.validationQuery=SELECT 1 from dual

-------------------------------------------------------------------

Notes for Postgresql

Note that the SQL that is optionally run at installation time uses the "DROP TABLE IF EXISTS TABLE-NAME;" command. This works fine for PostgreSQL 8.2 and above (which support "IF EXISTS") but not for earlier versions.

This is only a problem during the installation process; KonaKart performs well on versions of PostgreSQL prior to 8.2. To workaround this problem, for example for PostgreSQL 8.1, you will have to edit the database/konakart_demo.sql file and remove all the "DROP TABLE" commands then run this SQL manually. In addition to modifying the "IF EXISTS" syntax you will also have to add SQL statements to create sequences for all the SERIAL primary keys. For example, for the counter table, which is created like this:


CREATE TABLE counter (
  counter_id SERIAL,
  startdate char(8),
  counter integer,
  PRIMARY KEY (counter_id)
);

You have to create the SEQUENCEs with these conventions:


CREATE SEQUENCE <table>_<SERIAL column>_seq

for example:

.. for the counter_id column in the counter table above, you need to create a SRQUENCE like this:


CREATE SEQUENCE counter_counter_id_seq
  INCREMENT 1
  MINVALUE 1
  MAXVALUE 9223372036854775807
  START 1
  CACHE 1;

Another, preferable, alternative is to update to the latest version of PostgreSQL and run the standard GUI installation and have all the data loaded by the installer.

Notes for MySQL

Note that the SQL that is optionally run at installation time uses the "DROP TABLE IF EXISTS" syntax. This works fine for MySQL 5 and above, but not on MySQL 4.1.

This is only a problem during the installation process; KonaKart performs well on MySQL 4.1 but you have to modify the konakat_demo.sql file and run it yourself manually. You have to edit the database/konakart_demo.sql file and remove all the "DROP TABLE" commands then run this SQL manually. After successfully running this SQL you will be able to run KonaKart with MySQL 4.1.