Creating a database in Firebird using FireDac (Delphi)

I recently changed from AnyDac to FireDac (8.0.5.3365). We are launching Delphi 2006.

When I used the AnyDac version of this component, I could create a new database by doing the following.

Configure my connection

fConnection.LoginPrompt := false;
fConnection.ResourceOptions.SilentMode := true;

fConnection.Params.Clear;
fConnection.Params.Add(Format('DriverID=%s',          ['IB']));
fConnection.Params.Add(Format('Database=%s',          [fConnectionInfo.xDatabase]));
fConnection.Params.Add(Format('CharacterSet=%s',      ['UTF8']));
fConnection.Params.Add(Format('user_name=%s',         [fConnectionInfo.xUserName]));
fConnection.Params.Add(Format('password=%s',          [fConnectionInfo.xPassword]));
fConnection.Params.Add(Format('ExtendedMetadata=%s',  ['True']));
fConnection.Params.Add(Format('CreateDatabase=%s',    ['Yes']));
fConnection.Params.Add(Format('Protocol=%s',          ['Local']))

//database path = C:\Users\LoginName\AppData\Local\AppName\TestDB.FDB

Open and close the connection

fConnection.Open;
fConnection.Close;

And then I could run my sql scripts on the create table in an existing database.

But now, when I do this with the FireDac version, the Open command raises an fbe_unavailable error, as if I did not specify the CreateDatabase parameter.

Should I do it differently?

Thank you for your time.

Corey.

+4
source share
1 answer

http://docwiki.embarcadero.com/RADStudio/Rio/en/Executing_SQL_Scripts_%28FireDAC%29

, Firebird TFDScript:

SET SQL DIALECT 3;
SET NAMES UTF8;
SET CLIENTLIB 'C:\fb25\bin\fbclient.dll';
CREATE DATABASE 'E:\Test2.ib'
  USER 'sysdba' PASSWORD 'masterkey'
  PAGE_SIZE 16384
  DEFAULT CHARACTER SET NONE;

SET TERM ^ ;

CREATE PROCEDURE MY_PROC RETURNS (aParam INTEGER) AS
BEGIN
  aParam = 10;
END^

CreateDatabase = Yes :http://docwiki.embarcadero.com/RADStudio/Rio/en/Connect_to_Firebird_(FireDAC)

+2

Source: https://habr.com/ru/post/1523376/


All Articles