Google
 

Tuesday, November 16, 2004

Installing Firebird on FreeBSD

http://81.138.11.136:8080/tikifirebird/wiki/index.php?page=FirebirdOnFreeBSD

By far the easiest way to install Firebird is via a package, or the ports tree.
When people in the FreeBSD community get a package running on FreeBSD, they often submit how they did it as a 'port', back to FreeBSD.
( This saves you working out what configure scripts to change, which make to use (make, gmake, bmake, aimk, etc) )

So we'll follow the road they've already blazed. Of course, feel free to download the source tarball, and get it building yourself, but it could take a while...


If you can't find a pre-compiled binary package on FreeBSD.org, firebirdsql.org, or ibphoenix.com, sync up your ports tree.
(Building it yourself ensure's it's built using optimisations for the processor you're running, too)


once ports tree is updated, do:


code:


cd /usr/ports/databases/firebird
make install



Once this is finished, all dependencies are installed, the database is installed, the startup scripts are in place, the firebird user is added, and we're ready to go.

As the comment at the end of the install process suggests, we should change the password of the sysdba user, so lets do that now.

Starting Firebird
This involves running

code:

/usr/local/etc/rc.d/000.firebird.sh start
killall -HUP inetd


Or, simply reboot

Setting up Firebird's SYSDBA User

code:

cd /usr/local/firebird
./bin/gsec -user SYSDBA -pass masterkey
( the ./bin/ is required if you haven't got /usr/local/firebird/bin in your path )
GSEC> modify SYSDBA -pw

( We might add a user while we're here )
GSEC> add testuser -pw testuser

( Now quit out )
GSEC> quit



Done. Now we're ready for databases. the Firebird runs as the user firebird, thusly needs read/write permissions to a directory to store the databases.
I usually make one called '/usr/db':

code:

mkdir /usr/db
chown firebird /usr/db
chgrp firebird /usr/db
chown 770 /usr/db



There we have a nice, secure little home for our databases.
This directory isn't created by the install,as people will always want their databases stored in a different place, on a different HDD controller, etc.

Lets make a database

using your favourite editor, start a file in your home directory called 'fire1.sql', and in it, put the following:

code:

CREATE DATABASE "localhost:/usr/db/fire1.gdb".
COMMIT.

CREATE TABLE tbl_test1(
str_name VARCHAR(100) NOT NULL,
str_phone VARCHAR(20),
PRIMARY KEY(str_name)
).


Then save, and exit the file

Now, well create the database
( It may pay to put '/usr/local/firebird/bin' in your path, to save using the full path to the binaries every time )

code:

isql -u testuser -p testuser < fire1.sql


Logging in for the very first time
Lets log in, and have a look. Run:

isql -u testuser -p testuser localhost:/usr/db/fire1.gdb

Database: localhost:/usr/db/fire1.gdb, User: testuser
SQL>

You're in! Lets see what's inside:
( Note. Put a semi-colon at the end of every command. It's the terminator at the moment )


SQL> show tables;
TBL_TEST1
SQL>

Let see how that table's made up:
SQL> show table tbl_test1;
STR_NAME VARCHAR(200) Not Null
STR_PHONE VARCHAR(20) Nullable
CONSTRAINT INTEG_2:
Primary key (STR_NAME)
SQL >

Lovely! put some data in
SQL> insert into tbl_test1 (str_name, str_phone)
CON> values ('henry','12345678');
SQL>

( Note the 'CON>' appears while a statement is continuing )

Let's select everything in the table
SQL> select * from tbl_test1;
STR_NAME STR_PHONE
===== ===
henry 12345678

Lets put some more in
SQL> insert into tbl_test1 (str_name, str_phone)
CON> values ('jane','87654321');
SQL>

Select all
SQL> select * from tbl_test1;
STR_NAME STR_PHONE
==== ========
henry 12345678
jane 87654321

Select henry
select * from tbl_test1 where str_name = 'henry';

select people starting with 'h'
select * from tbl_test where str_name like 'h%';

select the first record
select first 1 * from tbl_test1;

select 1 record, but skip 1
select first 1 skip 1 * from tbl_test1;

select any records with the letter 'e' in them
select * from tbl_test1 where str_name containing 'e';

As you can see, the SQL is very similar to other databases.

3 comments:

dhd said...

This momentousdecree warcraft leveling came as a great beacon light wow lvl of hope to millions of negroslaves wow power level who had been seared power leveling in the flames of power leveling withering wrath of the lich king power leveling injustice.wrath of the lich king power leveling it came as a WOTLK Power Leveling joyous daybreak to end the long WOTLK Power Leveling night ofcaptivity.WOTLK Power Leveling but one hundred years wlk power leveling later, we must face aoc gold the tragic fact thatthe age of conan power leveling negro is still not free. aoc power leveling one hundred years later,age of conan power leveling the lifeof the negro ffxi gil is still sadly crippled by the final fantasy xi gil manacles ofsegregation guild wars gold and the chains of discrimination. one hundred yearslater, maplestory mesos the negro lives on a lonely island of poverty in themidst of a vast ocean of material prosperity.dog clothes one hundred yearslater

Adi said...

Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.

ambersbridal said...

A holy church, rings, a bouquet, a 3-floor wedding cake, lace wedding dress champagne, and the moving promise “ I do”, make up the happiest moment in one’s life. Then it is the wedding.
lace wedding gowns
A gorgeous wedding dress has been inside a girl’s dream since she was five years old. It is widely said that the bride is the most beautiful woman all over the world.
Bridal gowns vary in different parts of the world. For example, cheap wedding dresses plus sizein traditional Chinese culture, the color red is regarded for centuries as the symbol of good luck; while in the Occident, wedding dresses 2012 a full-length white wedding dress is always associated with romance and sanctity. But, with the globalization, wedding dresses tend to be alike in the whole world.