Embedded DB with bundled Jar?

22 views
Skip to first unread message

Adam McMahon

unread,
Aug 19, 2020, 2:44:54 PM8/19/20
to firebird-java
Hi,

I am working on a server-side app that uses embedded DBs.  I would like to give users the option to select which DB they want to use.  Currently the app works with H2, Derby, HSQL, and Firebird.  Getting it to run using the H2, Derby, and HSQL  is simply a matter of putting the jar on the classpath.  I am trying to determine the best way of handling this with Firebird.  I see three options

[1] Provide instructions to the user for how download FB for their OS and how to point JNA to the correct folder

[2] Work on bundling the native components into the jar, and then the user has to download the system specific jar

[3] Have the system detect the OS, and download all the native components into the current directory, and then set JNA to the current directory.

I think I favor option #3.  FB is a small download and the download process would only need to happen once at startup (or not at all if it has already been downloaded).

Would something like #3 work?  Can all the native components be put into the "current directly" or will some of them need to be in "system" folders?  Or will other environment variables need to be set as well?

Thanks,

-Adam


Mark Rotteveel

unread,
Aug 22, 2020, 2:57:04 AM8/22/20
to firebi...@googlegroups.com
On Windows, yes. I'm not entirely sure about Linux (some documentation
I've read suggests that Firebird must be installed on Linux for it to work).

On Windows, you can put all files in any directory, and then point JNA
to that directory. However, the engine also needs access to a lock
directory, and the default one likely doesn't exist (nor with the
correct rights) on your system. You can set the FIREBIRD_LOCK
environment variable to point to a directory.

Mark
--
Mark Rotteveel

Adam McMahon

unread,
Aug 22, 2020, 9:04:30 PM8/22/20
to firebird-java
Mark,

Thanks for the feedback.

I can confirm that windows embedded works fine by just downloading and dumping everything into the "current directory" and setting the JNA appropriately. I tried it on a computer that has never had firebird installed.  I hope that linux and mac can work similar.  It should be a matter of getting all the necessary files in the folder (even if some of those files are found elsewhere, just so they can run for FB embedded).

Without the ability to package FB embedded into a deployable  package, it seems like FB embedded is missing an important aspect.  If we can get FB embedded to be packaged (either as a jar or downloadable on the fly), I think FB could better compete in the same space as sqlite, derby, and H2.  I hope to work a bit more on the linux and mac process over the weekend.

Best,

-Adam

Mark Rotteveel

unread,
Aug 23, 2020, 4:00:51 AM8/23/20
to firebi...@googlegroups.com
On 23-08-2020 03:04, Adam McMahon wrote:
> Without the ability to package FB embedded into a deployable  package,
> it seems like FB embedded is missing an important aspect.  If we can get
> FB embedded to be packaged (either as a jar or downloadable on the fly),
> I think FB could better compete in the same space as sqlite, derby, and
> H2.  I hope to work a bit more on the linux and mac process over the
> weekend.

I have a prototype in the works that packages Firebird Embedded in a
jar. This will be available with Jaybird 5. So far, I have only tested
it on Windows though.

Mark
--
Mark Rotteveel

Doychin Bondzhev

unread,
Aug 23, 2020, 6:32:50 AM8/23/20
to firebi...@googlegroups.com
Yes that will be great

One more place where this can be helpful is when you need to run tests against FB database on CI environment.
No need of dedicated server machine/VM. Just provide the necessary scripts to create database or just provide empty database file with project where test can create the necessary tables.
--
You received this message because you are subscribed to the Google Groups "firebird-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-jav...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebird-java/2302e9ee-4a45-40d2-bae4-a490c3a684b0n%40googlegroups.com.


-- 
Doychin Bondzhev
dSoft-Bulgaria Ltd.
PowerPro - billing & provisioning solution for Service providers
http://www.dsoft-bg.com/
Mobile: +359888243116
doychin.vcf

Mark Rotteveel

unread,
Aug 23, 2020, 7:04:44 AM8/23/20
to firebi...@googlegroups.com
On 23-08-2020 12:32, 'Doychin Bondzhev' via firebird-java wrote:
> Yes that will be great
>
> One more place where this can be helpful is when you need to run tests
> against FB database on CI environment.
> No need of dedicated server machine/VM. Just provide the necessary
> scripts to create database or just provide empty database file with
> project where test can create the necessary tables.

For CI environments, I would recommend using
firebird-testcontainers-java instead:
https://github.com/FirebirdSQL/firebird-testcontainers-java

Some things might behave slightly different (eg produce different
errors) when connecting to a remote Firebird server compared to using
Firebird Embedded.

Mark
--
Mark Rotteveel
Reply all
Reply to author
Forward
0 new messages