Friday, May 14, 2010

Setting up a portable Firebird Full with VS 2010

 Setting up a Portable Firebird
  • Downloaded the ziped version of Firebird: 
  • Firebird-2.1.3.18185-0_Win32.zip
  • Extact to a folder
  • I prefer classic architecture running as an application (you do not need FB Guard also The path to file with or without a missing / in the beginning will not cause DB corruption).
  • Start the server with the bat file containing:
    "./FIREBIRD/bin/fb_inet_server.exe" -a -p 3050
  • using this you can change the port to something else. The -p switch is optional. Even allocate the port dynamically from your application. Also you can use the -n switch to start it silently:
    "./FIREBIRD/bin/fb_inet_server.exe" -a -n -p 3050
  • Stopping the portable classic server is easy. Just kill the process fb_inet_server. Of course this is assuming your application is done with everything (no pending transactions). There is no point in leaving the server running.
Changing the SYSDBA Password (default:masterkey) Actually it is masterke (since it is limited to 8 characters). But both work :)
  • FIREBIRD\bin>gsec  -user sysdba -password masterkey
  • GSEC>modify sysdba -pw yourpass
  • GSEC>quit
yourpass will be the new password

Connect to the database (connection String):
  • syntax
    IPAddress_or_ServerName/Port:Drive:\CompletePathToYourDatabasefile.fdb
  • e.g
    150.236.161.183/3051:D:\database.fdb
  • for softwares (e.g. FB development studio) that do not give you the option of port separately you need to specify the server as "IP/port". They use fbclient.dll 
For setting up Visual Studio 2010 with ADO.NET Entity Framework Designer just follow the procedure in the below post:

http://basaratali.blogspot.com/2010/02/setting-up-firebird-development-with-vs.html

    ADDITIONAL NOTES:

    To run as SuperServer

    • Start the server with the bat file containing:
      "./FIREBIRD/bin/fbguard.exe" -a
    • Firebird should now be running fine (with an FB guard icon in the taskbar notification area) Note: there should not be any whitespace after -a switch other than newline. Otherwise FBGuard thinks you are trying to provid additional arguments and does not start.
    • You might want to put a shortcut to this script in the startup. FB Guard ensures DB restart in case it crashes.
    • Alternatively you can use fbserver.exe -a -n -p 3051
    • This way you can even overwrite the default port on the command line (-p switch). But FB Guard is recommended for SuperServer.

    Changing the default Port (3050) via the configuration file:
    • You might want to change it so that your portable version does not conflict with firebird installed by someone else.
    • open firebird.conf (in the main folder)
    • Uncomment and change the following line:
      RemoteServicePort = 3051
    • Restart Firebird
    Choice of Firebird Architectures:
    According to : http://www.slideshare.net/mindthebird/why-firebird-fact-for-decision-makers?from=ss_embed Classic can handle larger data and more users. Enough said :). Also I recommend the other presentations from : http://mindthebird.com/downloadmtb.html 

    Using ISQL to create a new database (Recommended)
    • isql is found in your firebird bin folder. Just double click it
    • Type in the following:
      CREATE DATABASE 'D:\yourdb.fdb' user 'SYSDBA' password 'masterkey';
    • Of course use your own SYSDBA password and the location of where you want the database to be.
     
    Using Firebird Maestro to create a new database
    I used Firebird Maestro to create the database. You need to use :
    • Create New Database
    • Protocol:Embedded Server
    • Database:Complete path to where you want the fdb file
    I feel it is the best manager directed specifically for firebird.