Create database programmatically using embedded server

172 views
Skip to first unread message

Ertan Küçükoglu

unread,
Nov 2, 2021, 1:20:11 PM11/2/21
to firebird...@googlegroups.com
Hello,

All below is an embedded Firebird 3.0.7 Win32 system and everything is done using my own developed application.

I have no problem connecting to an existing database, running queries on it, doing CRUD etc.. When I try to programmatically create a database I get below error message

Unable to complete network request to host "xnet://Global\FIREBIRD"

If I am not wrong, "Remote" and "Local" are not active and only "Engine12" is active when we are using embedded. So, the above error message kind of makes sense.

My question is, is it possible to create a database using an embedded server?

For completeness, I am using Delphi 10.4 as a programming tool with UniDAC 8.3.2 database access components. I can successfully create a database if there is a local FirebirdSQL server running using identical code that gives the above error.

Thanks & Regards,
Ertan Küçükoğlu

Tomasz Tyrakowski

unread,
Nov 2, 2021, 2:18:01 PM11/2/21
to firebird...@googlegroups.com
Although I can't answer your question directly (haven't had much
experience with embedded, usually I cope with a classic client-server
setup), I might suggest a simple workaround. Have you thought about
creating an empty database (by hand, via isql or any other means) and
distributing it together with your app, as a kind of template? If you
need to create a new database, just copy (programmatically of course)
the template DB under a new name, then connect in embedded mode and
populate it just as you would any other database. Just skip the "create
database" step, use an already created one. Hope this helps if you don't
get any better suggestions (but I think you will ;) ).

regards
Tomasz

Tony Christiansen

unread,
Nov 3, 2021, 2:38:59 AM11/3/21
to firebird...@googlegroups.com
I do not use Unidac but I can confirm you can create a database with
embedded FB.

I use FB3.0.7 embedded with Delphi 10.4.2  and the TIBDatabase (IBX)
component to create a database.

This will create a database using a TFDConnection

    with fdConnection do begin
        DriverName := 'FB';
        LoginPrompt := False;
        Params.Clear;
        Params.add('');
        Params.Add('Database=' + edtDatabase.Text);
        Params.add('User_Name=' + edtUser.Text);
        Params.add('DriverID=FB');
        Params.add('Createdatabase=True');
        open;
    end;
Reply all
Reply to author
Forward
0 new messages