I recently changed from AnyDac to FireDac (8.0.5.3365). We're running Delphi 2006.
When I was using the AnyDac version of this component I could create a new database by doing the following..
Setup 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 create table sql scripts on the existing database.
But now when I do this with the FireDac version, the Open command raises the fbe_unavailable error as if I didn't specify the CreateDatabase parameter.
Should I be doing this a different way?
Thanks for your time.
Corey.
You have a full example here http://docwiki.embarcadero.com/RADStudio/Rio/en/Executing_SQL_Scripts_%28FireDAC%29
For example, the following Firebird script creates a database, and can be executed using 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^
You should use CreateDatabase=Yes connection definition parameter additionally to other required parameters: http://docwiki.embarcadero.com/RADStudio/Rio/en/Connect_to_Firebird_(FireDAC)