Subject Using Schemacachedir
Author John vd Waeter

Using D7, ibo 4.5b.

A schemacachedir is set before the ib_connection is connected.

I can see the local cachedir is filles with data after connection. So
far, so good, I guess.

Now starting the application, I can see errors in the logfile that the
table RDB$Schema_version could not be found. Indeed I could not see
such table in the database.So I read on in the IBO-helpfiles and noticed
the method IB_Connection.SchemaCache.CheckSchemaVersionTable.

Started the application again, connected to the database and via a
button fired this method.

Restarted the application again. Now I thought schemacache would be
properly set up. The ibo$schema_version table was there and locally the
cache was there.

But, logging the times it takes to open queries, I could see that
opening the first query still took 17 seconds (select bla1, vblah2 from
usertable where userid=:AUserid). This query returns just 1 row, apr.
300 bytes of data. The connection is slow over the internet, exactly the
reason to use the schemacache. But no improvements at all.

So, because the methodename suggests that a checkout is performed, I
again fired IB_Connection.SchemaCache.CheckSchemaVersionTable

The ibmonitor shows errors:

FIELDS = [ Version 1 SQLd 0 SQLn 52 ]
TR_HANDLE = 19095056
STMT_HANDLE = 19095752
PARAMS = [ ]

ISC ERROR CODE:335544665

violation of PRIMARY or UNIQUE KEY constraint "INTEG_80" on table

TIB_DSQL: "<TApplication>.dd.FBConnection.<TIB_DSQL>."

The RDB$Schema_version table is created in the database, 18 rows, with
all version_numbers set to zero.

The error is repeated 18 times, the number of records in the table.

And still no improvement on the first query.

I remember half a year ago in another project using just the
schemacachedir, NOT the RDB$Schema_version, and using that cachdir
speedup up opening of the first query significantly. But now it no
longer seems to work. Probably has something to do with the errors shown
in the monitor, but what?

I could not find a step by step instruction in the helpfiles about
properly setting up the schemacachedir and maybe related properties of
the ib_connection. Is there any such help? Or what am I doing wrong?