How to Create/Backup/Restore a database?

30 views
Skip to first unread message

Luciano Rodrigues Nunes Mendes

unread,
May 31, 2023, 7:44:45 AM5/31/23
to firebird-net-provider
Hi Guys,

Is there any possibility to Create/Backup/Restore a database using only the ADO.NET provider without needing isql.exe and gbak.exe?

Thanks in advance,
Luciano

Jiří Činčura

unread,
May 31, 2023, 8:06:36 AM5/31/23
to 'Mr. John' via firebird-net-provider
Yep. CreateDatabase is on FbConnection. B&R is FbBackup and FbRestore (also FbStreamingXxx).

--
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/
> --
> You received this message because you are subscribed to the Google
> Groups "firebird-net-provider" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to firebird-net-pro...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/firebird-net-provider/a867097a-7759-47b6-bc3c-8bdb8a2712ebn%40googlegroups.com
> <https://groups.google.com/d/msgid/firebird-net-provider/a867097a-7759-47b6-bc3c-8bdb8a2712ebn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Luciano Rodrigues Nunes Mendes

unread,
Jun 2, 2023, 8:17:37 AM6/2/23
to firebird-n...@googlegroups.com
Hi Jiří

Thank you very much for your prompt reply!

I noticed that the default pageSize is 4096 in the CreateDatabase Method:

Screenshot 2023-06-02 090705.png

Shouldn't the default pageSize be the Firebird version pageSize (2.5 = 4096 / 3.0 and 4.0 = 8192)?

Other than that I didn't find any option to set the default collation at database creation time (See: Firebird 3.0 Language Reference). Should I open an issue to add this option?

Thanks in advance,
Luciano

Jiří Činčura

unread,
Jun 2, 2023, 8:32:15 AM6/2/23
to 'Mr. John' via firebird-net-provider
> Shouldn't the default pageSize be the Firebird version pageSize (2.5 =
> 4096 / 3.0 and 4.0 = 8192)?

Not really. This is default value for method parameter.

> Other than that I didn't find any option to set the default collation
> at database creation time (See: Firebird 3.0 Language Reference
> <https://firebirdsql.org/file/documentation/html/en/refdocs/fblangref30/firebird-30-language-reference.html#fblangref30-ddl-db-create>).
> Should I open an issue to add this option?

This is not available via API. It needs to be done after the DB is created (i.e. https://github.com/FirebirdSQL/NETProvider/blob/master/src/FirebirdSql.EntityFrameworkCore.Firebird/Storage/Internal/FbDatabaseCreator.cs#L159)

Luciano Rodrigues Nunes Mendes

unread,
Jun 3, 2023, 6:50:16 AM6/3/23
to firebird-n...@googlegroups.com
Hi Jiří

I meant that if the user doesn't define a page size when using the FbConnection.CreateDatabase command shouldn't this command create a database using the default value of the Firebird version instead of 4096?

Does default collation not available via the API during database creation mean we should open a bug for Firebird to make it available?

Also, which Connection String should I use to create a database using legacy authentication in firebird 3? I am using the following Connection String and "Authentication error - No matching plugins on server" error is happening:
"pooling=False;server type=Default;data source=LOCALHOST;port number=3050;initial catalog=ARAS_CIN;user id=SYSDBA;password=masterkey;character set=WIN1252;role name=RDB$ADMIN"

Thanks in advance,
Luciano

--
You received this message because you are subscribed to the Google Groups "firebird-net-provider" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-net-pro...@googlegroups.com.

Tomasz Dubiel

unread,
Jun 3, 2023, 7:44:43 AM6/3/23
to firebird-net-provider
With next Firebird versions there are simply available bigger page sizes, but they are not default and that doesn't mean that every database should have bigger page size. For small databases  4096 should be enough.

Mark Rotteveel

unread,
Jun 3, 2023, 8:09:56 AM6/3/23
to firebird-n...@googlegroups.com
On 03-06-2023 13:44, Tomasz Dubiel wrote:
> With next Firebird versions there are simply available bigger page
> sizes, but they are not default and that doesn't mean that every
> database should have bigger page size. For small databases  4096 should
> be enough.

The default page size (when it is not specified by isc_dpb_page_size
when using op_create) is 4096 for Firebird 2.5 (I believe since Firebird
1.0), for Firebird 3.0 and higher the default page size is 8192.

Mark
--
Mark Rotteveel

Jiří Činčura

unread,
Jun 3, 2023, 8:49:17 AM6/3/23
to 'Mr. John' via firebird-net-provider
> I meant that if the user doesn't define a page size when using the
> FbConnection.CreateDatabase command shouldn't this command create a
> database using the default value of the Firebird version instead of
> 4096?

That would be an option. The 4k was default value in provider since "forever" and changing the behavior would be a breaking change. And given the added value (or lack of it), I don't think the breaking change is justified. Everybody has it's own sweet spot for database page size.

> Does default collation not available via the API during database
> creation mean we should open a bug for Firebird to make it available?

You can. But bear in mind, that it will work only in new Firebird versions and hence you still need fallback for older versions.

> Also, which Connection String should I use to create a database using
> legacy authentication in firebird 3? I am using the following

Unless you want to use older FirebirdClient, legacy auth is not supported.

Luciano Rodrigues Nunes Mendes

unread,
Jun 3, 2023, 8:46:18 PM6/3/23
to firebird-n...@googlegroups.com
Hi Mark,

How should I describe the firebird API issue for not supporting collation when creating a database?
Could you help me describe this issue?

thanks in advance,
Luciano

--
You received this message because you are subscribed to the Google Groups "firebird-net-provider" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-net-pro...@googlegroups.com.

Mark Rotteveel

unread,
Jun 4, 2023, 5:10:31 AM6/4/23
to firebird-n...@googlegroups.com
On 04-06-2023 02:46, Luciano Rodrigues Nunes Mendes wrote:
> How should I describe the firebird API issue for not supporting
> collation when creating a database?
> Could you help me describe this issue?

I don't think that will be changed. The API only has the information
which must be known when creating the database. Even the parser of
`CREATE DATABASE` just executes the equivalent of `ALTER CHARACTER SET
<db-charset> SET DEFAULT COLLATION <db-collation>` after it successfully
created the database.

In fact, even the default database character set is not really part of
the API to create a database, but it is exposed as a DPB item for
historic reasons (changing the database character set wasn't originally
part of ALTER DATABASE, so the isc_dpb_set_* options was needed to
change it).

Looking through the Firebird 5.0 source code, create database happens in
two parts:

1) fbclient.dll intercepts the `CREATE DATABASE` statement, collects the
minimum necessary information to create the database (page size,
username, password, role, and *connection* character set), and then
creates the database,
2) it then executes the `CREATE DATABASE` statement on the newly created
database, which takes care of the rest of the initialization of the
database (it ignores the parts which were already used in the first step).

Mark
--
Mark Rotteveel

Luciano Rodrigues Nunes Mendes

unread,
Jun 4, 2023, 11:38:55 AM6/4/23
to firebird-n...@googlegroups.com
Hi Mark,

Thank you very much for your clarifications as always very accurate!

Best regards,
Luciano

--
You received this message because you are subscribed to the Google Groups "firebird-net-provider" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-net-pro...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages