Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable WireCompression on Firebird 3.0 using FireDAC [duplicate]

I am looking to connect to Firebird Server 3.0 using WireCompression. This being new feature since version 3.0 I'm having a hard time to get it to do so and the only documented instructions I can find is setting WireCompression to TRUE in firebird.conf and use the connect parameter "wirecompression=true".

This is what I've got this far:

firebird.conf:

# Firebird configuration file for Firebird 3.0 64-bit SuperServer
# Optimized by IBSurgeon (www.ib-aid.com) for HQbird distribution.
#

ServerMode = Super

#DatabaseAccess = Full
#RemoteAccess = true
#ExternalFileAccess = None
#UdfAccess = Restrict UDF
#TempDirectories =
#AuditTraceConfigFile =
#MaxUserTraceLogSize = 10

DefaultDbCachePages = 50000

#DatabaseGrowthIncrement = 128M
#FileSystemCacheThreshold = 64K
#FileSystemCacheSize = 0
#RemoteFileOpenAbility = 0

TempBlockSize = 2M
TempCacheLimit = 364M

AuthServer = Srp
AuthClient = Srp, Win_Sspi, Legacy_Auth
UserManager = Srp
#WireCryptPlugin = Arc4

#hqbird traceapi plugin should be in plugins folder!
TracePlugin = fbtrace2db

#CryptPlugin = Arc4
#KeyHolderPlugin =
#Providers = Remote,Engine12,Loopback
#DeadlockTimeout = 10
#MaxUnflushedWrites = 100
#MaxUnflushedWriteTime = 5
#BugcheckAbort = 0
#RelaxedAliasChecking = 0
#ConnectionTimeout = 180
#(for client) / Required (for server)

WireCompression = true
WireCrypt = enabled
#DummyPacketInterval = 0
#RemoteServiceName = gds_db

RemoteServicePort = 3050

#RemoteAuxPort = 0
#TcpRemoteBufferSize = 8192
#TcpNoNagle = 1
#RemoteBindAddress =

LockMemSize = 9M

#LockAcquireSpins = 0

LockHashSlots = 30011

#EventMemSize = 64K
#CpuAffinityMask = 0
#GCPolicy = combined
#SecurityDatabase = $(dir_secDb)/security3.fdb

GuardianOption = 1

#ProcessPriorityLevel = 0
#IpcName = FIREBIRD
#RemotePipeName = interbas

Code to connect:

  //Info: FDB = TFDConnection
  with FDB.Params do
  begin
      Clear;
      Add('DriverID=FB');
      Add('Database=' + vDatabase);
      Add('User_Name=' + AUsername);
      Add('PassWord=' + APassword);
      Add('WireCompression=true');
  end;

  FDB.FetchOptions.Unidirectional:= true;
  FDB.FetchOptions.RowsetSize:= 1000;
  FDB.ResourceOptions.SilentMode:= true;

  FDB.Connected := true;

  vConnectionInfo:= TStringList.Create;
  FDB.GetInfoReport(vConnectionInfo);

  ShowMessage(vConnectionInfo.Text);

  Clipboard.AsText:= vConnectionInfo.Text;

  FreeAndNil(vConnectionInfo);

  Result := FDB.Connected;

The connection is established, but vConnectionInfo says:

================================
Connection definition parameters
================================
DriverID=FB
Database=server:D:\Databases\FB3.0\test\test.FDB
User_Name=sysdba
PassWord=*****
WireCompression=true
================================
FireDAC info
================================
Tool = RAD Studio 10.1 Berlin
FireDAC = 15.0.1 (Build 86746)
Platform = Windows 32 bit
Defines = FireDAC_NOLOCALE_META;FireDAC_MONITOR
================================
Client info
================================
Loading driver FB ...
Brand = Firebird
Client version = 300009900
Client DLL name = D:\D10\Projects\TestFB30 Client\Win32\Debug\fbclient.dll
================================
Session info
================================
Current catalog = 
Current schema = 
Server version = WI-V3.0.0.32483 Firebird 3.0
WI-V3.0.0.32483 Firebird 3.0/tcp (server)/P13:C
WI-V3.0.0.32483 Firebird 3.0/tcp (laptop)/P13:C

Those last two lines say I have protocol v13 (P13) and the data is enCrypted (:C) but it should be P13:CZ indicating a zlib compression.

i have the zlib1.dll in the debug folder on the client side, and the zlib1.dll is present on the server in the Firebird server folder.

I can connect to the database, I get no error messages.

I am running out of ideas to get the compression to be applied, but I have faith in you guys to help me out!

like image 434
Christiaan ten Klooster Avatar asked Nov 30 '16 09:11

Christiaan ten Klooster


1 Answers

In order to enable zlib compression using FireDAC all you need to do is:

  1. Enable wirecompression server side using firebird.conf by setting wirecompression=true
  2. Have the proper/same version of fbclient.dll client side
  3. Place the correct zlib1.dll (x86 in my case) in the folder that contains the client exe
  4. Create a firebird.conf and add the line wirecompression=true and save it to the same folder your exe is.
  5. Add wirecompression=true to the connection params

Wirecompression is now enabled.

like image 144
Christiaan ten Klooster Avatar answered Nov 11 '22 12:11

Christiaan ten Klooster