DotNetFirebird.org DotNetFirebird
Using Firebird SQL in .NET.
Monday, January 09, 2006

New Firebird News Blog Site

There is a new weblog site dedicated to Firebird: Firebird News sponsored by FireBase.

Via Firebird Weekly News: http://firebirdnews.blogspot.com/2006/01/firebird-news-hq.html.


Thursday, January 05, 2006

FlameRobin: FlameRobin 0.5 Released

A promising open-source Firebird management tool is released in version 0.5:

Wednesday, January 04, 2006

Sample Code for Shriking a Database (aka Vacuuming)

Oscar Porcar contributed a piece of code that does a database backup and restore to keep its size as small as possible. It might be useful for cases when you insert and delete some temporary data and the database size increases (the server doesn't shrink it automatically - instead it reuses the "empty" space when adding new data.

  /// 
  /// Frees all unnecesary space from the database file.
  /// 
  private static void __Vacuum()
  {
  bool error;

  FbBackup _bak = new FbBackup();
  _bak.ConnectionString =
@"ServerType=1;PageSize=8192;Database=c:\temp\foo.fdb";
  _bak.BackupFiles.Add( new FbBackupFile( @"c:\temp\foo.fdb.bak", 4096 ) );
  _bak.Options = FbBackupFlags.NonTransportable;
  _bak.Execute();
  FbConnection.ClearAllPools();

  // delete original database file
  error = true;
  while ( error )
  {
    try
    {
    File.Delete( @"c:\temp\foo.fdb" );
    error = false;
    }
    catch
    {
    System.Threading.Thread.Sleep( 1000 );
    }
  }

  FbRestore _res = new FbRestore();
  _res.ConnectionString =
@"ServerType=1;PageSize=8192;Database=c:\temp\foo.fdb";
  _res.BackupFiles.Add( new FbBackupFile( @"c:\temp\foo.fdb.bak", 4096 ) );
  _res.Options = FbRestoreFlags.Create | FbRestoreFlags.Replace;
  _res.Execute();
  FbConnection.ClearAllPools();

  // delete backup database file
  error = true;
  while ( error )
  {
    try
    {
    File.Delete( @"c:\temp\foo.fdb.bak" );
    error = false;
    }
    catch
    {
    System.Threading.Thread.Sleep( 1000 );
    }
  }

  // db file is uppercase, so change name ...
  error = true;
  while ( error )
  {
    try
    {
    File.Move( @"c:\temp\foo.fdb", @"c:\temp\foo.fdb.TEMPLATE" );
    error = false;
    }
    catch
    {
    System.Threading.Thread.Sleep( 1000 );
    }
  }

  // ... to rename correctly
  error = true;
  while ( error )
  {
    try
    {
    File.Move( @"c:\temp\foo.fdb.TEMPLATE", @"c:\temp\foo.fdb" );
    error = false;
    }
    catch
    {
    System.Threading.Thread.Sleep( 1000 );
    }
  }
  }
 }

Sunday, January 01, 2006

Please Spread the Word about the Firebird in .NET Tutorial

Please distribute the information about the Request for Ideas: Firebird in .NET Tutorial if you have a chance - I would like to collect as much feedback as possible before I fix the structure. Hopefully the tutorial will help the Firebird community grow ;-).

Request for Ideas: Firebird in .NET Tutorial

I'm working on a tutorial that should cover the basics of Firebird and its usage in .NET. The following topics should be included:
  • tables (data types, autoincrement, DDL)
  • stored procedures (creating and calling, parameters)
  • calling from .NET (stored procedures, closing the connection properly, default transactions)
It should be published 1 February at the latest. What do you think should be included:
  • What was a problem for you when you was starting with Firebird?
  • What mistakes do you make when working with Firebird?
  • What is different when you come from other database systems?
Please post your ideas as comments!

Update (9 February 2006):

Read more about the structure and current status: Status of the Firebird Tutorial for .NET.


Previous

Archives