如何在Firebird 3.0上启用Wirecompression [英] How to enable wirecompression on Firebird 3.0

查看:160
本文介绍了如何在Firebird 3.0上启用Wirecompression的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与Firebird和Delphi合作,我想通过有线压缩通过Internet实现访问; 但是我无法激活它.

I work with Firebird and Delp I want to implement access via internet with wirecompression; But I am unable to activate it.

我已经按照本文档中的步骤操作了新参数(我能够找到的少数几个参数之一) 如何使用FireDAC在Firebird 3.0上启用WireCompression

I have followed the steps inside this document for the new parameter(one of the few I was able to find) How to enable WireCompression on Firebird 3.0 using FireDAC

在我使用的测试中 Windows Server 2012 R2 火鸟:Firebird-3.0.4.33054_0_Win32(32 bits) 也复制到可执行文件夹. fbclient.dll zlib1.dll(同构服务器和客户端) 使用wirecompression = true创建firebird.conf. 并且我在应用程序的Firedac中提供了wirecompression = true.

In the tests I use Windows server 2012 R2 Firebird : Firebird-3.0.4.33054_0_Win32(32 bits) Also copied to executable folder. fbclient.dll zlib1.dll (idem server and client) created firebird.conf with wirecompression=true. and I am giving wirecompression=true inside the Firedac of the application.

为什么我无法激活P15:CZ压缩?

Why am I unable to activate the P15:CZ compression ?

Sending connection info for the example:
================================
Connection definition parameters
================================
DriverID=FB
Database=miservidor001:C:\sysdat\C100\gestdat03.fdb
User_Name=SYSDBA
PassWord=*****
WireCompression=true
================================
FireDAC info
================================
Tool = RAD Studio 10.2
FireDAC = 16.0.0 (Build 88974)
Platform = Windows 32 bit
Defines = FireDAC_NOLOCALE_META;FireDAC_MONITOR
================================
Client info
================================
Loading driver FB ...
Brand = Firebird
Client version = 300049900
Client DLL name = C:\APPS\WC01\fbclient.dll
================================
Session info
================================
Current catalog = 
Current schema = 
Server version = WI-V3.0.4.33054 Firebird 3.0
WI-V3.0.4.33054 Firebird 3.0/tcp (WIN-2012LAGO003)/P15:C
WI-V3.0.4.33054 Firebird 3.0/tcp (nucleo)/P15:C'

推荐答案

注意:我不了解Delphi或FireDAC,此答案基于Firebird的一般行为以及我维护其JDBC驱动程序(Jaybird)的经验.因此,可能有一个专门针对FireDAC/Delphi的更好的答案.

NOTE: I don't know Delphi nor FireDAC, this answer is based on the general behavior of Firebird and my experience with maintaining its JDBC driver (Jaybird). So it is possible that there is a better answer specifically for FireDAC/Delphi.

启用或禁用线路压缩完全由客户端而不是服务器决定.这意味着服务器的配置不是必需的,也没有任何作用,除非在服务器本身充当客户端的情况下(例如,使用execute statement ... on external datasource.

Enabling or disabling wire compression is entirely determined by the client, not by the server. This means that configuration of the server is not necessary nor has it any effect, except in cases where the server itself acts as a client, for example with execute statement ... on external datasource.

要使用导线压缩,您需要三件事:

To be able to use wire compression, you need three things:

  1. fbclient.dll
  2. zlib1.dll(与fbclient.dll在同一位置,或在搜索路径上)
  3. 为客户端启用电线压缩的配置
  1. fbclient.dll
  2. zlib1.dll (in the same location as fbclient.dll, or on the search path)
  3. A configuration to enable wire compression for the client

第3点可能是您的问题:我不确定FireDAC是否具有实际上启用电线压缩的连接属性WireCompression.

Point 3 is likely your problem: I'm not sure if FireDAC has a connection property WireCompression that actually enables wire compression.

我知道两种为客户端启用电线压缩的方法:

I know of two ways to enable wire compression for the client:

  1. 在与应用程序使用的fbclient.dll相同的目录中创建firebird.conf.在此配置文件中,放入请求的配置选项(每行一个):

  1. Create a firebird.conf in the same directory as the fbclient.dll used by your application. In this configuration file, put the requested configuration options (one per line):

WireCompression = true
# maybe other config lines (eg AuthClient, WireCrypt, etc)

  • 而不是创建firebird.conf文件,而是在isc_dpb_config(int 87)数据库参数项中传递配置(使用换行符分隔配置选项).

  • Instead of creating a firebird.conf file, pass the configuration (with linebreaks separating config options) in the isc_dpb_config (int 87) database parameter item.

    该值与上一个选项中的firebird.conf文件的内容相同.如果客户端使用旧的数据库参数缓冲区格式(字符串最大为255个字节),并且您要传递(很多)更多的配置选项,则可能会遇到大小问题.

    The value is the same as the content of the firebird.conf file in the previous option. This may run into size issues if the client is using the old database parameter buffer format (where strings are max 255 bytes) and you want to pass (a lot) more config options.

    选项1可能是最简单的,并且适用于所有框架.选项2取决于框架或驱动程序是否公开数据库参数缓冲区,或者它是否具有映射到isc_dpb_config的连接属性.

    Option 1 is probably the simplest and will work for all frameworks. Option 2 depends on whether or not the framework or driver exposes the database parameter buffer or if it has a connection property that maps to isc_dpb_config.

    例如,在使用Jaybird的Java中,您可以使用以下方式启用压缩(仅在使用本机连接时):

    For example in Java using Jaybird, you can enable compression (only when using native connections) using:

    Properties props = new Properties();
    props.setProperty("user", "sysdba");
    props.setProperty("password", "masterkey");
    props.setProperty("config", "WireCompression=true");
    
    try (var connection = DriverManager.getConnection(
            "jdbc:firebirdsql:native:localhost:D:/data/db/fb3/fb3testdatabase.fdb", props)) {
    
        FirebirdConnection fbCon = connection.unwrap(FirebirdConnection.class);
        FbDatabase fbDatabase = fbCon.getFbDatabase();
        System.out.println(fbDatabase.getServerVersion());
    
    } catch (SQLException e) {
        e.printStackTrace();
    }
    

    这将打印出WI-V3.0.4.33054 Firebird 3.0,WI-V3.0.4.33054 Firebird 3.0/tcp (host)/P15:CZ,WI-V3.0.4.33054 Firebird 3.0/tcp (host)/P15:CZ(请注意,这是<server version>,<server protocol info>,<client protocol info>)

    This prints out WI-V3.0.4.33054 Firebird 3.0,WI-V3.0.4.33054 Firebird 3.0/tcp (host)/P15:CZ,WI-V3.0.4.33054 Firebird 3.0/tcp (host)/P15:CZ (note this is <server version>,<server protocol info>,<client protocol info>)

    在这里,config属性是isc_dpb_config的别名.

    Here, the config property is an alias for isc_dpb_config.

    这篇关于如何在Firebird 3.0上启用Wirecompression的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆