FireBird Embedded - Create a New Database

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
TimeAcct
Posts: 2
Joined: Mon 12 Dec 2011 07:46

FireBird Embedded - Create a New Database

Post by TimeAcct » Tue 17 Dec 2013 17:01

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

AndreyZ

Re: FireBird Embedded - Create a New Database

Post by AndreyZ » Wed 18 Dec 2013 09:40

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;

TimeAcct
Posts: 2
Joined: Mon 12 Dec 2011 07:46

Re: FireBird Embedded - Create a New Database

Post by TimeAcct » Wed 18 Dec 2013 21:23

Thank you! This works exactly the way I have been hoping!

AndreyZ

Re: FireBird Embedded - Create a New Database

Post by AndreyZ » Thu 19 Dec 2013 08:25

You are welcome. If any other questions come up, please contact us.

Post Reply