Subject CreateDatabase() causing AV
Author Sampo Ahokas
Greetings,

This is my first post here, and I'm still rather new to IBO/FB.

I am trying to create a database from my program, using
IB_Connection.CreateDatabase() but it keeps failing due to access violation.

I am using D2006Pro and IBO 4.6A beta (which Jason sent me to test IBO
in D2006, and I have no other version of IBO available since I have not
yet received response to trustware application).

What I am exactly doing is:

- I have a project with 1 form, which contains 1 button and 1
TIB_Connection component

- I have the following code on button's OnClick

with IB_Connection1 do begin
Username:='sahokas';
Password:='salasana';
Protocol:=cpLocal;
DatabaseName:='E:\ibotest\testi1.fdb';
CreateDatabase;
end;

When execution gets to call to CreateDatabase(), I am getting AV:

"Access Violation at address 0000... Read of address 0000...."

Exact point where it happens is in IB_Session.pas at the following call:
errcode := isc_dsql_execute_immediate( @Status,
@dbHandle,
@trHandle,
null_terminated,
PChar(CreateString),
SQLDialect,
nil );

At that point CreateString is as follows:
'CREATE DATABASE 'E:\ibotest\testi1.fdb' USER 'sahokas' PASSWORD
'salasana' PAGE_SIZE = 1024'

The exactly same string (without ' in the beginning and end of course)
works fine when used from from commandline windows ISQL. ISQL and my
program are running from the same directory so version of the DLL and
everything else should be the same.

I have tried setting more properties in IB_Connection (charset,
forcedwrites, loginprompt, pagesize, etc) and tried connecting to remote
server as well. I'm using the latest 1.5.3 release and I have tried with
both fbembedd.dll and fbclient.dll, renamed to gds32.dll etc. Result is
always the same. Connecting to a database made with other application
works fine using IB_Connection.Connect().

Any input or pointer where to look would be much appreciated, running
out of ideas here.

Thanks in advance.

Sampo