#native_company# #native_desc#
#native_cta#

Getting started with php and InterBase Page 5

By Yves Glodt
on February 12, 2002

Creating a New Database User

Before creating a new db, we create a user, which we will use for these examples
(username ‘phptest’ and password ‘phptest’).
This can be done using the ‘gsec’ tool that comes with
InterBase. Assuming your ‘sysdba’ password is ‘masterkey’, use it like this:
/opt/interbase/bin/gsec -user sysdba -password masterkey -add 'phptest' -pw 'phptest'

Creating a Test Database

Before creating the database, download this script: createdb.sql.
(You might need to adapt the encoding for your country. ISO8859_1 fits well for western Europe.)
The script looks like this:
SET SQL DIALECT 3;

CREATE DATABASE 'phptest.gdb'
PAGE_SIZE=8192
DEFAULT CHARACTER SET ISO8859_1;

CREATE TABLE ADDRESS
(
CATEGORY INTEGER NOT NULL,
NAME VARCHAR(100) NOT NULL,
KEYINDEX INTEGER NOT NULL,
ADDRESS BLOB SUB_TYPE TEXT SEGMENT SIZE 100,
PRIMARY KEY (KEYINDEX)
);

GRANT SELECT,DELETE,INSERT,UPDATE ON ADDRESS TO phptest;

commit;
Create the database, using this command:
/opt/interbase/bin/isql -i createdb.sql -u sysdba -p masterkey
It’s always a good idea to keep scripts around that are able to (re)create your database(s).
I remind you to change the ‘sysdba’ password, the whole world knows ‘masterkey’ 😉