Statement failed sqlcode 904 unavailable database

sql code : 904 [DOC55] #62


Submitted by: Arul Jose. R (aruljose)

My firebird installation is throwing 904 sql code. Could not find any description for this in firebird documentation.
What does this SQL code mean?

C:\arul\firebird\Firebird-\bin>isql -u SYSDBA -p masterkey
Use CONNECT or CREATE DATABASE to specify a database
SQL> CREATE DATABASE ‘c:\arul\firebird\utftester1.fdb’ user ‘SYSDBA’ password ‘masterkey’;
Statement failed, SQLCODE = -904
unavailable database

C:\arul\firebird\Firebird-\bin>isql -u SYSDBA -p masterkey ..\security2.fdb
Statement failed, SQLCODE = -904
unavailable database
Use CONNECT or CREATE DATABASE to specify a database

The text was updated successfully, but these errors were encountered:

First, please do not use the Tracker for support questions!

As for your problem: either the server isn’t running or the local protocol isn’t working correctly.

Try creating ‘localhost:c:\arul\firebird\utftester1.fdb’

If you get a network error, try instead of localhost, or the hostname or IP address of your machine.

If one of these methods works, the local protocol caused the failure. This can often be fixed by opening firebird.conf, uncommenting the IpcName parameter and setting it to Global\FIREBIRD. After this, you must restart the server.

If not, make sure that the server is running. Check Services and/or process list.


Database-transfer to DB2/zOS fails on FEEDBACK domain with SQLCODE: -904, SQLSTATE: 57011, SQLERRMC: 00C900A3



When executing the WebSphere Portal ConfigEngine script ‘database-transfer’ to transfer the Portal data from Derby to DB2/zOS, it may fail at the Feedback database domain with DB2 exceptions SQLCODE: -904, SQLSTATE: 57011, SQLERRMC: 00C900A3


In the ConfigTrace.log, the full exception will be:

[sqlproc] action: execute-sql-scripts
[sqlproc] _________________________________________________________
[sqlproc] DbDomain: feedback
[sqlproc] Database autocommit parameter false
[sqlproc] Reading file /opt/IBM/WebSphere/wp_profile/ConfigEngine/config/work/pzn/db2_zos/fbk_Data.sql
[sqlproc] Connected to jdbc:db2://
[sqlproc] Setting database autocommit to:false
[sqlproc] INSERT INTO feedback.LOGCONTROL (LogState, ReportServer, ReportSSL) VALUES
[sqlproc] (0, 'localhost', 0)

[sqlproc] Error during statement execution!
[sqlproc] DB2 SQL error: SQLCODE: -904, SQLSTATE: 57011, SQLERRMC: 00C900A3;00000200;FDBKDB.FBTBSPCE
[sqlproc] at
[sqlproc] at
[sqlproc] at


The exception froms from the DB2/zOS system:


It essentially means that the Tablespace mentioned in the SQLERRMC portion of the exception (in this case FDBKDB.FBTBSPCE) is in «check pending» state and unable to process requests.

Normally, the database administrator can run «CHECK DATA» against the failing tablespace, but in this case CHECK DATA does not resolve the issue. The feedback transfer merely puts the tablespace back into ‘check pending’ status.

This issue was ultimately caused by a corrupt tablespace.

Resolving The Problem

To resolve this problem, drop and recreate the faulty tablespace. Once that is done, re-execute the database-transfer.


Ошибка SQLCODE -904 в firebird после установки

Установил базу данных firebird первый раз в жизни (версия 1.5.6 на Windows 7), после установки не могу ни подключиться к демонстрационной базе (employee.fdb существует), ни создать базу. Это дает следующую ошибку в ISQL Tool:

задан 09 мая ’13, 20:05

Если это первый раз, то почему вы устанавливаете старую версию 1.5 вместо последней версии 2.5.2? — Mark Rotteveel

2 ответы

Firebird 1.5 был написан (задолго) до Windows 7 и до того, как появились такие вещи, как UAC. Возможно, просто Firebird 1.5 некорректно работает с Windows 7 или требует дополнительных усилий для работы. Я бы предложил установить Firebird 2.5.2 (обновление 1) поскольку это последняя версия, и известно, что она работает с Windows 7.

Другая проблема может заключаться в том, что локальные системные соединения не работают, поскольку я, кажется, помню, что Firebird 1.5 использует старый локальный протокол, который не работает в более новых версиях Windows. Этот протокол был заменен в Firebird 2.0. Чтобы обойти это, вам нужно включить имя хоста в CREATE DATABASE or CONNECT утверждение, например:

ответ дан 10 мая ’13, 07:05

Windows 7+ ломает локальный протокол API. Вы должны использовать протокол Tcpip для подключения к базе данных, даже для локальных подключений.

ответ дан 13 авг.

Не тот ответ, который вы ищете? Просмотрите другие вопросы с метками firebird firebird1.5 or задайте свой вопрос.


SQL -904 Top Reasons to Get This Error

This is mainly occurred due to work space is not available in the DB2. In the real scenario, If we need to deal with multiple rows, there is enough work space is needed , else we get SQL Code-904. Resolution: (Source IBM Red book)

A new online updatable DSNZPARM, MAXTEMPS, has been added to DSN6SYSP. This DSNZPARM specifies the maximum amount of workfile storage that an agent can use and is specified in units of MBs or GBs. If the DSNZPARM value is specified as 0, then no limit is enforced, which was the default in previous releases.

  • When the total storage used by an agent exceeds the MAXTEMPS value that you specified, a Resource Unavailable message (DSNT501I) and a Resource Unavailable SQLCODE (-904) are issued.

Tthe activity that caused this condition terminates. The -904 message has a new reason code and resource name as shown in the below example.

New resource unavailable information

The MAXTEMPS DSNZPARM can protect your workfile from becoming exhausted by runaway queries and declared global temporary tables, however make sure you have enough 32 KB WORKFILE space allocated to avoid -904 resource unavailable failures for large declared global temporary tables (DGTT) since they cannot span workfiles.

Pertinent APARs on space reuse and performance for DGTT for INSERT/DELETE are PK62009, PK67301, and PK70060.

The current recommendation is to allocate workfiles with secondary extents for use by DGTT.

In-memory workfile support is provided when the final sort output data that would have been stored in a work file is less than the 4 KB or 32 KB pagesize of the selected work file. This means that small sorts are not written out to the work file, but the results are presented directly from the WORKFILE 4 KB or 32 KB buffer.

This usage of in-memory workfile support provides a performance enhancement. In one test measurement, we achieved a 10 to 30% CPU reduction for small sorts. This enhancement is not available for declared global temporary tables (both user-defined and used by DB2) as they are always written to the WORKFILE.

In-memory workfile support is expected to be of most benefit for online transactions with relatively short-running SQL calls in which the number of rows that are sorted can be small.


Statement failed sqlcode 904 unavailable database

Answers were Sorted based on User’s Feedback

RESOURCE. REASON reason-code, TYPE OF RESOURCE resource-
type, AND RESOURCE NAME reason-name
Explanation: The SQL statement could not be executed
because resource resource-name of type resource-type was
not available at the time for the reason indicated by

Try to display the stats of the table and check if it is in
RW mode, If not use the required repair utility to get the
table to RW mode.

If the table is in RW mode then may be the underlying
dataset may have got deleted in that case we will need to
do a dummy load to get those created.

If that also doesnt work will need to drop and recreate the
objects from TABLESPACE level.

Ths above is for IBM DB2 for z/os. Correct me if Iam wrong

Is This Answer Correct ? 3 Yes 0 No

When querying or retrieving items or importing new items,
the library server returns [LS RC = 7015, SQL RC = -904]

DGL5050A: SQL error executing query. XQPE query: /ITA
Return code: 7015. Reason code: 0. Extended return code: —
Extended reason code: 0.
(STATE) : [LS RC = 7015, SQL RC = -904] There is also a
warning in the library server log:

ICMPLSCP handleForeignKeys 06174 03/09 06:25:24.457 GMT
;09045111471478 16:10285a68c22:X7ea2 IFVTE WARNING—
Please perform CHECK DATA command on z/OS.
Possible cause
When adding a foreign key to an existing component type
table (ICMUTnnnnnsss), SQLCode 162 is returned. DB2® places
a table space into CHECK PENDING state if:

Any table in that table space has ever been populated at
any time.
A foreign key is added or modified for any table in the
table space.
The library server performs and commits the foreign key
creation. However, a warning message is written to the
library server log to remind you to run the CHECK DATA DB2
utility so that tables and views in this table space can be


SQLCode 162
+162 TABLESPACE database-name.tablespace-name HAS BEEN
Explanation: The indicated table space is in check pending
status because the ALTER TABLE statement was used to
specify a referential constraint or a check constraint
(while special register CURRENT RULES = ‘DB2’) on a
populated table. The table space is not generally available
until the check pending status is removed from the table

System Action: The table space was placed in check pending

Programmer Response: Run the CHECK DATA utility. The
enforcement of the referential constraint or the check
constraint is deferred until the CHECK DATA utility is run.

SQLCode -904
RESOURCE. REASON reason-code, TYPE OF RESOURCE resource-
type, AND RESOURCE NAME reason-name
Explanation: The SQL statement could not be executed
because resource resource-name of type resource-type was
not available at the time for the reason indicated by