gpt4 book ai didi

delphi - 如何使用 FireDAC 在 Firebird 3.0 上启用 WireCompression

转载 作者:行者123 更新时间:2023-12-03 15:11:01 27 4
gpt4 key购买 nike

我希望使用 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 压缩。

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

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

我已经没有办法应用压缩了,但我相信你们会帮助我!

最佳答案

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

  1. 通过设置wirecompression=true,使用firebird.conf启用wirecompression服务器端
  2. 拥有正确/相同版本的 fbclient.dll 客户端
  3. 将正确的 zlib1.dll(在我的例子中为 x86)放入包含客户端 exe 的文件夹中
  4. 创建 firebird.conf 并添加 linecompression=true 行并将其保存到 exe 所在的同一文件夹中。
  5. 将wirecompression=true添加到连接参数

线路压缩现已启用。

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

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com