Subject Re: [Firebird-Java] Creating Firebird-Embedded database connection
Author Mark Rotteveel
On Fri, 04 Nov 2011 15:00:41 -0000, "mariuz"
<mariuz@...-dev.ro>
wrote:
> if anyone know how to do that in netbeans please send him a message
>
>
http://article.gmane.org/gmane.comp.java.ide.netbeans.user/168253/match=firebird+databases
>
> I will forward this page
> http://www.firebirdfaq.org/faq350/

What is the actual question? That message does not provide any clue as to
the actual problem.

Is it about:
* establishing a connection in Netbeans itself (which has a database
manager for development purposes)
* establishing a connection in a Java program to an embedded Firebird
* creating a database for an embedded Firebird
* ... ?

For the first option:
I am not 100% sure, but most likely you will need to copy the
jaybird21.dll / jaybird21.so and embedded files in the right location of
Netbeans, and maybe there are additional config options. But to be honest:
I don't think using embedded in Netbeans itself makes much sense.

In essence for the last two (connecting and creating from a Java program):
* Put Firebird embedded in the root of your project
* Copy jaybird21.dll / jaybird21.so in the root of your project
(putting these files in the root of the project should ensure they are
also available when testing and debugging the application, there may be
other, better ways, but I haven't actually used embedded with Jaybird
except for testing Jaybird itself)
* Make sure that when you build your project all these files are also
copied into the final distribution folder (*not* into the jar file!)

Creating an embedded database called database.fdb (in the program startup
location (at least on Windows)):

FBManager manager = new FBManager(GDSType.getType("EMBEDDED"));
manager.start();
manager.createDatabase("database.fdb", "", "");
manager.stop();

Creating a connection to an embedded database:

Class.forName("org.firebirdsql.jdbc.FBDriver");
Connection bd =
DriverManager.getConnection("jdbc:firebirdsql:embedded:database.fdb");