Page 1 of 1

Can't open old database with Firebird 1.5-2.1

Posted: 09.09.2019, 11:42
by MN7
Zeos can't open old database with old Firebird (2.0 for example).
Tables can be acquired with ZConnection.GetTableNames. But next Zeos can't get data with ZQuery or ZTable: raise EZSQLException:

SQL Error: Dynamic SQL ErrorSQL error code = -206Column unknownB.RDB$FIELD_PRECISIONAt line 1, column 249. Error Code: -206. Column does not belong to referenced table The SQL: SELECT a.RDB$RELATION_NAME, a.RDB$FIELD_NAME, a.RDB$FIELD_POSITION, a.RDB$NULL_FLAG, a.RDB$DEFAULT_VALUE, b.RDB$FIELD_LENGTH, b.RDB$FIELD_SCALE, c.RDB$TYPE_NAME, b.RDB$FIELD_TYPE, b.RDB$FIELD_SUB_TYPE, b.RDB$DESCRIPTION, b.RDB$CHARACTER_LENGTH, b.RDB$FIELD_PRECISION, a.RDB$DEFAULT_SOURCE, b.RDB$DEFAULT_SOURCE as RDB$DEFAULT_SOURCE_DOMAIN,b.RDB$COMPUTED_SOURCE , b.RDB$CHARACTER_SET_ID FROM RDB$RELATION_FIELDS a JOIN RDB$FIELDS b ON (b.RDB$FIELD_NAME = a.RDB$FIELD_SOURCE) LEFT JOIN RDB$TYPES c ON (b.RDB$FIELD_TYPE = c.RDB$TYPE and c.RDB$FIELD_NAME = 'RDB$FIELD_TYPE') WHERE 1=1 AND a.RDB$RELATION_NAME = 'CUSTOMER' ORDER BY a.RDB$RELATION_NAME, a.RDB$FIELD_POSITION;

Re: Can't open old database with Firebird 1.5-2.1

Posted: 12.09.2019, 18:06
by marsupilami
Hello,

Zeos tries to query data about the CUSTOMER table in your database. Firebird fails to read the field RDB$FIELD_PRECISION. This field is used to store information about numeric and and decimal data types.

Given that information the query should work on all Firebird and Interbase versions. I tested that it runs correctly on Firebird 2.0. Maybe your database is corrupted?

Best regards,

Jan

Re: Can't open old database with Firebird 1.5-2.1

Posted: 13.09.2019, 17:49
by MN7
I'm use embedded dll (x86).

My DB is test DB from book about Delphi 7.
My code was 'ZConnection.HostName := 'localhost';'. When I change HostName to '' (empty) Zeos can open that DB. (FB 1.5 and 2.1 tested).

But.
My second DB is test DB from book about Delphi 5. And Zeos raise same error! Changing HostName not help.

Any other parameters I can try to set?