Monday, 9 May 2011

Firebird sql; How to make the Firebird SQL server portable, supporting the network connections!!!


situation

Firebird SQL server project, supports to be portable, as your application will use the same DLLs as the Firebird SQL server does; by this way you may open FDB files from your application without install the Firebird Server. The main disadvantage is that you can’t open the same FDB file from other application and of course there is no network support to open the FDB as remote database from other terminal(s).
By the way, if you are interesting how you do this, search at the internet and at Firebird's official page. I’ll go further as I will show to you how to make the Firebird server portable as it is, with network support also!
problem

Firebird
How to make the Firebird SQL server portable, supporting the network connections!!!
difficulty level

9/10 :(
compatibility

fb 2.0, 2.1 & 2.5
solution

- If you haven’t do this, install on a computer the firebird sql server.- Stop the service if it is running.
- Go to at “c:\Program Files (x86)\Firebird\” and copy whole “Firebird_2_0” directory somewhere else where you will play with it.
- Now go at the new location of Firebird.
- If you have made any modifications to firebird.conf… delete them.
- START the server; at the root directory of firebird, create the fbstart.bat with the follow two lines:
            cd bin
            fbserver.exe -a -p 55005 -database "localhost:..\security2.fdb" –n
  [i] some explanations,
      - the name fbserver.exe might be different regarding the version you are working with; this cheat/improvement is working with 2.0, 2.1 and 2.5 FB version.
      - the 55005 is the tcp ip port where the server will listen; I suggest you to keep it like this because the environment where your application (and portable firebird server) will work might already have another Firebird server installed, so the port 3050 will be occupied. For this simple reason use this port where it’s free. Of course you must do register an exception at windows firewall with port 55005 (as you should do also with 3050) and you should update your database connection component to use the 55005 port instead of 3050. For your initial test use the 3050 port instead of 55005 to check if are working well (replace in the previous code the 55005 with 3050; don’t leave it blank).
      - the –n switch tells the server to do not show its icon at system tray… you may remove this switch.
      - when you will run this batch, the cmd window will remain open; this batch is for test purposes, call the fbserver.exe with these parameters from your application to start the server (read the next important note).
      - NOTE: you must check to run the Firebird only once, if the server is already running you must not load it again.
- STOP the server; at the root directory of firebird, create the fbstop.bat with the follow line:
            taskkill /F /IM fbserver.exe /T
That’s all… good luck…
attention

Do not run the server more than once in the same time, check it is running or not.

No comments:

Post a Comment