Computer Programming Solutions
TECHNICAL INFORMATION SHEET

Deploying an IB Objects Application

Distributing an IBO application is a very simple process.

In any IBO based application there are four essential pieces to make it work: The database server, the database file, the database client, and the application executable file.

There is no need to install the BDE or any of its SQL Links drivers. ODBC is also totally unnecessary.

Single-User Installation
By installing LIBS (Local InterBase Server) the database client is also installed automatically. So, the only part remaining is to install the database file and the EXE.

You can copy the EXE onto the machine and either generate the database automatically from the EXE using a TIB_Script component with DDL statements to produce the database or copy it (using gbak -restore if necessary) into its intended location if it is already produced ahead of time.

Multi-User Installation
Of course you must first have network connectivity and the InterBase or Firebird Server installed on your server and configured to allow remote clients to attach to it.  With commercial versions of InterBase this requires that certain license keys be entered through the license manager tool provided with a production copy of InterBase.

Instead of installing LIBS on the client machine you need only install the IB Client to allow that client to establish a connection to the remote server. Then, the rest is the same as above.

Suggested Configuration
Do NOT hardcode your database connect string into the EXE. If you need to change the location of a database you would have to recompile your application and update it. Use a system registry entry to contain the desired connection string for the application or provide some sort of internal storage so that the user can adjust the database connection string.

How to configure the client
Sample code provided by José Antonio Galicia mailto:jcgalici@cbbanorte.com.mx.

procedure TDatamodule1.DataModule1Create(Sender: TObject);
Var
  s : String;
  i : Integer;
  b : Boolean;
  Buf : PChar;
begin
  With TRegistry.Create Do Try
    RootKey := HKEY_LOCAL_MACHINE;
    If OpenKey('SOFTWARE\Borland\InterBase\CurrentVersion', True) Then
    If Not ValueExists('RootDirectory') Then
    WriteString('RootDirectory', ExtractFilePath(ParamStr(0)));
  Finally
    Free;
  End;
  i := 255;
  GetMem(Buf, i);
  With TStringList.Create Do Try
    If Win32Platform = VER_PLATFORM_WIN32_NT Then Begin
      GetEnvironmentVariable(PChar('SystemRoot'), Buf, i);
      s := Buf + '\System32\drivers\etc\services';
    End Else Begin
      GetEnvironmentVariable(PChar('WinDir'), Buf, i);
      s := Buf + '\services';
    End;
    LoadFromFile(s);
    b := True;
    For i := 0 To Count-1 Do
      If Copy(Strings[i], 1, 6) = 'gds_db' Then begin
        b := False;
        Break;
      end; 
    If b Then Begin
      Add('gds_db 3050/tcp # Borland InterBase Server');
      SaveToFile(s);
    End;
  Finally
    Free;
    FreeMem(Buf);
  End;
  With TIniFile.Create('.\myapp.ini') Do Try
    DataBase.DBName := ReadString('Server', 'Name', 'DBHost:') +
    ReadString('Server', 'path', '/database/path/') +
    ReadString('Server', 'DataBase', 'DATABASE.GDB');
  Finally
    Free;
  End;
end;