This question already has answers here:
How to enable wirecompression on Firebird 3.0

(2个答案)


2个月前关闭。




我希望使用WireCompression连接到Firebird Server 3.0。自3.0版以来,这是一项新功能,我很难做到这一点,我只能找到的书面说明是将firebird.conf中的WireCompression设置为TRUE,并使用连接参数“wirecompression = true”。

这就是我到目前为止所得到的:

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

连接代码:
  //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;

建立了连接,但是vConnectionInfo表示:
================================
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

最后两行说我有协议(protocol)v13(P13),并且数据已加密(:C),但应该为P13:CZ,表示zlib压缩。

我在客户端的debug文件夹中有zlib1.dll,并且Firebird服务器文件夹中的服务器上存在zlib1.dll。

可以连接到数据库,但我收到没有错误消息。

我已经没有足够的想法来应用压缩了,但是我相信你们能帮助我!

最佳答案

为了使用FireDAC启用zlib压缩,您需要做的是:

  • 通过设置wirecompression = true
  • 来使用firebird.conf启用Wirecompression服务器端
  • 具有正确/相同版本的fbclient.dll客户端
  • 将正确的zlib1.dll(在我的情况下为x86)放在包含客户端exe
  • 的文件夹中
  • 创建一个firebird.conf并添加wirecompression = true行,并将其保存到您的exe所在的文件夹中。
  • 将wirecompression = true添加到连接参数

  • 现在启用了线压缩。

    关于delphi - 如何使用FireDAC在Firebird 3.0上启用WireCompression,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40884109/

    10-13 02:43