How to create a database from Java using FB embedded?
You don't need to use isql, gbak or any external too. There is a class provided by Jaybird called org.firebirdsql.management.FBManager.
Here's an example how to use it:
FBManager manager = new FBManager("EMBEDDED");
manager.start();
manager.createDatabase("/path/to/database_file.fdb", 'usr', 'pwd');
manager.stop();
First parameter is the database filename, and second and third parameters are username and password. Since username and are not checked by Firebird (at least on Windows version of embedded), you can provide any two strings.
Do you find this FAQ incorrect or incomplete? Please e-mail us what
needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird
databases), before it enters the main FAQ database. If you desire so, the
changes will be credited to your name. To learn more, visit our add content page.
All contents are copyright © 2007-2024 FirebirdFAQ.org unless otherwise stated in the text.