Subject | Failed to create database with Firebird embedded 1.5.0.4027 |
---|---|
Author | chaucheeyang |
Post date | 2003-12-02T17:18:54Z |
Hi,
I have a problem here. I am using Firebird embedded 1.5.0.4027 with
delphi 7 / DBX / Windows XP. I have renamed the FBEmbed.dll to
gds32.dll as instructed and I can access the firebird database with
the firebird embedded dll smoothly. But when I I tried to run the
following code to create the database, I found the error:
The create database code is working fine if i use the firebird
server. I suspect the isc_dsql_execute_immediate is not working
properly for fbembed.dll. Am I doing something wrong here. Please
advice. Thank you.
Error:
------
"Operating System directive CreateFile failed.
The process cannot access the file because it is being used by
another process."
Create database code:
----------------------
function CreateIBDatabase(DatabaseName: string;
AUserName: string; APassword: string): boolean;
var tr_handle: TISC_TR_HANDLE;
DB_Handle: TISC_DB_HANDLE;
lStatement: string;
begin
Result := False;
CheckIBLoaded;
try
DB_Handle := nil;
tr_Handle := nil;
lStatement := Format('CREATE DATABASE "%s" USER "%s" PASSWORD "%
s" ', [DatabaseName, AUserName, APassword]);
if isc_dsql_execute_immediate(
StatusVector, @DB_Handle, @tr_handle, 0,
PChar(lStatement),
3, nil
) > 0 then
IBDatabaseError
else
Result := True;
finally
FreeIBLibrary;
end;
end;
I have a problem here. I am using Firebird embedded 1.5.0.4027 with
delphi 7 / DBX / Windows XP. I have renamed the FBEmbed.dll to
gds32.dll as instructed and I can access the firebird database with
the firebird embedded dll smoothly. But when I I tried to run the
following code to create the database, I found the error:
The create database code is working fine if i use the firebird
server. I suspect the isc_dsql_execute_immediate is not working
properly for fbembed.dll. Am I doing something wrong here. Please
advice. Thank you.
Error:
------
"Operating System directive CreateFile failed.
The process cannot access the file because it is being used by
another process."
Create database code:
----------------------
function CreateIBDatabase(DatabaseName: string;
AUserName: string; APassword: string): boolean;
var tr_handle: TISC_TR_HANDLE;
DB_Handle: TISC_DB_HANDLE;
lStatement: string;
begin
Result := False;
CheckIBLoaded;
try
DB_Handle := nil;
tr_Handle := nil;
lStatement := Format('CREATE DATABASE "%s" USER "%s" PASSWORD "%
s" ', [DatabaseName, AUserName, APassword]);
if isc_dsql_execute_immediate(
StatusVector, @DB_Handle, @tr_handle, 0,
PChar(lStatement),
3, nil
) > 0 then
IBDatabaseError
else
Result := True;
finally
FreeIBLibrary;
end;
end;