Subject Re: [firebird-support] Firebird Unavailable Database
Author Tiberiu Horvath
OK, the information :

A. Server side : Firebird 2.1.0.17798

Database "C:\DEVELOP\ALAsigurari\ASIGURARI.GDB"
Database header page information:
Flags 0
Checksum 12345
Generation 1067
Page size 4096
ODS version 11.1
Oldest transaction 1057
Oldest active 1058
Oldest snapshot 1058
Next transaction 1059
Bumped transaction 1
Sequence number 0
Next attachment ID 33
Implementation ID 16
Shadow count 0
Page buffers 0
Next header page 0
Database dialect 3
Creation date Jun 2, 2008 18:23:01
Attributes

Variable header data:
Sweep interval: 20000
*END*


Database file sequence:
File C:\DEVELOP\ALAsigurari\ASIGURARI.GDB is the only file

table : asigurat - metadata example

CREATE TABLE "ASIGURAT"
(
"ID_ASIGURAT" INTEGER NOT NULL,
"ID_LOCALITATE" INTEGER,
"NR_ORD_REG_COM" CHAR(15),
"COD_IDENTIFICARE_AGENT" CHAR(13),
"DENUMIRE_AGENT" CHAR(60),
"ADRESA" CHAR(60),
"TELEFON" CHAR(30),
"FAX" CHAR(30),
"BANCA" CHAR(20),
"CONT" CHAR(30),
"DELEGAT" CHAR(30),
"CARTE_IDENTITATE_SERIA" CHAR(2),
"CARTE_IDENTITATE_NUMAR" CHAR(10),
"AUTORIZATIA" CHAR(20),
"PERSOANA_DE_CONTACT" CHAR(30),
"SCUTIT_TVA" DECIMAL(1,0),
"CNP" DECIMAL(13,0),
"ZILE_SCADENTA" DECIMAL(3,0),
"MIJLOC_DE_TRANSPORT" CHAR(10),
"MIJLOC_DE_TRANSPORT_NR" CHAR(30),
"E_PERS_JURIDICA" DECIMAL(1,0),
"TELEFON_MOBIL" VARCHAR(30),
"CONT_CIEL" CHAR(15),
"FUNCTIA" CHAR(20),
"CI_ELIBERAT_DE" CHAR(30),
"CI_ELIBERAT_DATA" DATE,
"MAMA" CHAR(15),
"TATA" CHAR(15),
"PROFESIE" CHAR(15),
"LOC_MUNCA" CHAR(30),
"DATA_NASTERE" DATE,
"ID_LOC_NASTERE" INTEGER,
"STATUS_BNR" INTEGER,
"CAEN" INTEGER,
"EMAIL" CHAR(30),
"PREFIX" INTEGER,
"SUFIX" INTEGER,
"ID_LOCALITATE_EXPEDITIE" INTEGER,
"ADRESA_EXPEDITIE" CHAR(60),
"TELEFON_REPREZENTANT" CHAR(13),
"MARIME" INTEGER,
CONSTRAINT "PK_ASIGURAT" PRIMARY KEY ("ID_ASIGURAT")
);
ALTER TABLE "ASIGURAT" ADD CONSTRAINT "FK_ASIGURAT_REFERENCE_LOCALIT" FOREIGN KEY ("ID_LOC_NASTERE") REFERENCES "LOCALITATE" ("ID_LOCALITATE");
ALTER TABLE "ASIGURAT" ADD CONSTRAINT "FK_ASIGURAT_REFERENCE_LOCALITA" FOREIGN KEY ("ID_LOCALITATE") REFERENCES "LOCALITATE" ("ID_LOCALITATE");
ALTER TABLE "ASIGURAT" ADD CONSTRAINT "FK_ASIGURAT_REFERENCE_LOC_EXP" FOREIGN KEY ("ID_LOCALITATE_EXPEDITIE") REFERENCES "LOCALITATE" ("ID_LOCALITATE");
SET TERM ^ ;


/* Triggers only will work for SQL triggers */

CREATE TRIGGER "ID_ASIGURAT_TRIGGER" FOR "ASIGURAT"
ACTIVE BEFORE INSERT POSITION 0
AS BEGIN NEW.id_asigurat= GEN_ID (ID_ASIGURAT_GEN, 1); end
^

COMMIT WORK ^
SET TERM ;^





B. Client side :
Delphi 2007 Win32

database:
object database: TIBDatabase
Params.Strings = (
'user_name=SYSDBA'
'password=exact2207')
LoginPrompt = False
DefaultTransaction = trans
TraceFlags = [tfQPrepare, tfQExecute, tfQFetch, tfError, tfStmt, tfConnect, tfTransact, tfBlob, tfService, tfMisc]
Left = 32
Top = 8
end

transaction :
object trans: TIBTransaction
DefaultDatabase = database
Params.Strings = (
'read_committed'
'rec_version'
'nowait')
Left = 104
Top = 8
end

tables in Delphi - example - all tables use the same components
object asigurat: TIBDataSet
Database = database
Transaction = trans
DeleteSQL.Strings = (
'delete from ASIGURAT'
'where'
' ID_ASIGURAT = :OLD_ID_ASIGURAT')
InsertSQL.Strings = (
'insert into ASIGURAT'

' (ADRESA, ADRESA_EXPEDITIE, AUTORIZATIA, BANCA, CAEN, CARTE_IDE' +
'NTITATE_NUMAR, '

' CARTE_IDENTITATE_SERIA, CI_ELIBERAT_DATA, CI_ELIBERAT_DE, CNP' +
', COD_IDENTIFICARE_AGENT, '

' CONT, CONT_CIEL, DATA_NASTERE, DELEGAT, DENUMIRE_AGENT, E_PER' +
'S_JURIDICA, '

' EMAIL, FAX, FUNCTIA, ID_ASIGURAT, ID_LOC_NASTERE, ID_LOCALITA' +
'TE, ID_LOCALITATE_EXPEDITIE, '

' LOC_MUNCA, MAMA, MARIME, MIJLOC_DE_TRANSPORT, MIJLOC_DE_TRANS' +
'PORT_NR, '

' NR_ORD_REG_COM, PERSOANA_DE_CONTACT, PREFIX, PROFESIE, SCUTIT' +
'_TVA, STATUS_BNR, '

' SUFIX, TATA, TELEFON, TELEFON_MOBIL, TELEFON_REPREZENTANT, ZI' +
'LE_SCADENTA)'
'values'

' (:ADRESA, :ADRESA_EXPEDITIE, :AUTORIZATIA, :BANCA, :CAEN, :CAR' +
'TE_IDENTITATE_NUMAR, '

' :CARTE_IDENTITATE_SERIA, :CI_ELIBERAT_DATA, :CI_ELIBERAT_DE, ' +
':CNP, :COD_IDENTIFICARE_AGENT, '

' :CONT, :CONT_CIEL, :DATA_NASTERE, :DELEGAT, :DENUMIRE_AGENT, ' +
':E_PERS_JURIDICA, '

' :EMAIL, :FAX, :FUNCTIA, :ID_ASIGURAT, :ID_LOC_NASTERE, :ID_LO' +
'CALITATE, '

' :ID_LOCALITATE_EXPEDITIE, :LOC_MUNCA, :MAMA, :MARIME, :MIJLOC' +
'_DE_TRANSPORT, '

' :MIJLOC_DE_TRANSPORT_NR, :NR_ORD_REG_COM, :PERSOANA_DE_CONTAC' +
'T, :PREFIX, '

' :PROFESIE, :SCUTIT_TVA, :STATUS_BNR, :SUFIX, :TATA, :TELEFON,' +
' :TELEFON_MOBIL, '
' :TELEFON_REPREZENTANT, :ZILE_SCADENTA)')
RefreshSQL.Strings = (
'Select '
' ID_ASIGURAT,'
' ID_LOCALITATE,'
' NR_ORD_REG_COM,'
' COD_IDENTIFICARE_AGENT,'
' DENUMIRE_AGENT,'
' ADRESA,'
' TELEFON,'
' FAX,'
' BANCA,'
' CONT,'
' DELEGAT,'
' CARTE_IDENTITATE_SERIA,'
' CARTE_IDENTITATE_NUMAR,'
' AUTORIZATIA,'
' PERSOANA_DE_CONTACT,'
' SCUTIT_TVA,'
' CNP,'
' ZILE_SCADENTA,'
' MIJLOC_DE_TRANSPORT,'
' MIJLOC_DE_TRANSPORT_NR,'
' E_PERS_JURIDICA,'
' TELEFON_MOBIL,'
' CONT_CIEL,'
' FUNCTIA,'
' CI_ELIBERAT_DE,'
' CI_ELIBERAT_DATA,'
' MAMA,'
' TATA,'
' PROFESIE,'
' LOC_MUNCA,'
' DATA_NASTERE,'
' ID_LOC_NASTERE,'
' STATUS_BNR,'
' CAEN,'
' EMAIL,'
' PREFIX,'
' SUFIX,'
' ID_LOCALITATE_EXPEDITIE,'
' ADRESA_EXPEDITIE,'
' TELEFON_REPREZENTANT,'
' MARIME'
'from ASIGURAT '
'where'
' ID_ASIGURAT = :ID_ASIGURAT')
SelectSQL.Strings = (
'select * from ASIGURAT order by DENUMIRE_AGENT')
ModifySQL.Strings = (
'update ASIGURAT'
'set'
' ADRESA = :ADRESA,'
' ADRESA_EXPEDITIE = :ADRESA_EXPEDITIE,'
' AUTORIZATIA = :AUTORIZATIA,'
' BANCA = :BANCA,'
' CAEN = :CAEN,'
' CARTE_IDENTITATE_NUMAR = :CARTE_IDENTITATE_NUMAR,'
' CARTE_IDENTITATE_SERIA = :CARTE_IDENTITATE_SERIA,'
' CI_ELIBERAT_DATA = :CI_ELIBERAT_DATA,'
' CI_ELIBERAT_DE = :CI_ELIBERAT_DE,'
' CNP = :CNP,'
' COD_IDENTIFICARE_AGENT = :COD_IDENTIFICARE_AGENT,'
' CONT = :CONT,'
' CONT_CIEL = :CONT_CIEL,'
' DATA_NASTERE = :DATA_NASTERE,'
' DELEGAT = :DELEGAT,'
' DENUMIRE_AGENT = :DENUMIRE_AGENT,'
' E_PERS_JURIDICA = :E_PERS_JURIDICA,'
' EMAIL = :EMAIL,'
' FAX = :FAX,'
' FUNCTIA = :FUNCTIA,'
' ID_ASIGURAT = :ID_ASIGURAT,'
' ID_LOC_NASTERE = :ID_LOC_NASTERE,'
' ID_LOCALITATE = :ID_LOCALITATE,'
' ID_LOCALITATE_EXPEDITIE = :ID_LOCALITATE_EXPEDITIE,'
' LOC_MUNCA = :LOC_MUNCA,'
' MAMA = :MAMA,'
' MARIME = :MARIME,'
' MIJLOC_DE_TRANSPORT = :MIJLOC_DE_TRANSPORT,'
' MIJLOC_DE_TRANSPORT_NR = :MIJLOC_DE_TRANSPORT_NR,'
' NR_ORD_REG_COM = :NR_ORD_REG_COM,'
' PERSOANA_DE_CONTACT = :PERSOANA_DE_CONTACT,'
' PREFIX = :PREFIX,'
' PROFESIE = :PROFESIE,'
' SCUTIT_TVA = :SCUTIT_TVA,'
' STATUS_BNR = :STATUS_BNR,'
' SUFIX = :SUFIX,'
' TATA = :TATA,'
' TELEFON = :TELEFON,'
' TELEFON_MOBIL = :TELEFON_MOBIL,'
' TELEFON_REPREZENTANT = :TELEFON_REPREZENTANT,'
' ZILE_SCADENTA = :ZILE_SCADENTA'
'where'
' ID_ASIGURAT = :OLD_ID_ASIGURAT')
GeneratorField.Field = 'ID_ASIGURAT'
GeneratorField.Generator = 'ID_ASIGURAT_GEN'
Left = 32
Top = 44
end



Thank you,

Tiberiu



----- Original Message ----
From: Helen Borrie <helebor@...>
To: firebird-support@yahoogroups.com
Sent: Tuesday, June 3, 2008 10:44:13 AM
Subject: Re: [firebird-support] Firebird Unavailable Database


The purpose of that question was to try and drag some information from you about your database, e.g., its ODS version, its dialect, etc. etc.

The usual reason for this kind of crashing behaviour (if you eliminated bad UDFs as the source of it) is legacy applications (often written in Delphi) that don't pay attention to long-running transactions, hard commits and garbage collection.. ..the more the users hammer this style of application, the more frequent will be the hangups and crashes.

../heLen