Page 1 of 1

FireBird Embedded - Create a New Database

Posted: Tue 17 Dec 2013 17:01
by TimeAcct
Hello Everyone,

I have a need to be able to create a database in the Embedded Firebird database engine - using my delphi program.

The problem I have is that I seem to need a database to connect to - before I can run any SQL commands :) However, the UniConnection component won't connect to the Firebird FBEmbed.dll without an existing database. But that is the DB I want to create.

I suppose I could ship an empty database that I could connect to - but that sort of defeats the purpose of what I am trying to do (make this program self sufficient).

How do others deal with this issue? Is there a way around it?

thank you for any input.

G. Bradley MacDonald

Re: FireBird Embedded - Create a New Database

Posted: Wed 18 Dec 2013 09:40
by AndreyZ
Hello,

You can create a Firebird embedded database using the TUniScript component. Here is a code example:

Code: Select all

UniConnection1.ProviderName := 'InterBase';
UniConnection1.SpecificOptions.Values['ClientLibrary'] := 'fbembed.dll';
UniScript1.NoPreconnect := True;
UniScript1.SQL.Text := 'create database ''c:\test.fdb''';
UniScript1.Execute;

Re: FireBird Embedded - Create a New Database

Posted: Wed 18 Dec 2013 21:23
by TimeAcct
Thank you! This works exactly the way I have been hoping!

Re: FireBird Embedded - Create a New Database

Posted: Thu 19 Dec 2013 08:25
by AndreyZ
You are welcome. If any other questions come up, please contact us.