DelphiXE10.4 + UniDAC 链接 PostgreSQL 15 笔记

本文讲述了在将数据库从PostgreSQL8升级到15版本后,如何解决使用UniDAC连接问题,包括SSLMode参数调整、Windows和Linux环境下缺少DLL的处理,以及不同版本OpenSSL库的下载和配置方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最近公司业务需要,将数据库postgresql升级到了15版本,原来使用的UniDAC版本是8,发现连接不上数据库了。于是升级了UniDAC版本到9.4版。不管是设计期,还是运行期,都还是无法连接上PostgreSql 15(一下简称PG15),真是不知道问题出在哪里;

1,连接数据库参数设置

后来经过同事的帮忙,发现是参数的问题,只需要修改一个SSLMode就可以连接上了;而且并不需要升级UniDac的版本;参数修改成如下图:

如果是运行期动态连接数据库,需要增加如下一行代码:

UniConnection.SpecificOptions.Values['SSLMode'] := 'smAllow';

 2,WINDOW环境,缺少DLL的解决办法

如果运行时连接数据库,出现以下报错信息:

OpenSSL client library couldn''t be loaded. Please place libeay32.dll and ssleay32.dll (or libssl32.dll) to system folder (included to PATH) or to the folder with executable unit of main program.

意思是:缺少libeay32.dll文件,需要将libeay32.dll文件加到系统环境变量,或者是将libeay32.dll文件放到运行程序的指定目录;

解决办法:需要将libeay32.dll 和 ssleay32.dll文件(注意对应的Target Platforms,.dll版本也不一样),放到系统文件夹(包含在PATH中)或带有主程序可执行单元的文件夹中,

可以是Win32\Debug或者Win64\Debug目录中

3,Linux环境,缺少DLL的解决办法

如果是Linux下连接PG15数据库,遇到如下错误提示:

 'OpenSSL client library couldn'''t be loaded. Please place libssl.so file to system folder (included to LD_LIBRARY_PATH) or to the folder with executable unit of main program.'#015#012'libssl.so: 无法打开共享对象文件: 没有那个文件或目录'

只需要在Linux系统中升级一下OpenSSL,再将libssl.so配置到环境变量里面即可;

我使用的CentOS 7 – 64虚拟系统;

安装OpenSSL

[root@localhost ~]# sudo yum install openssl-devel

将libssl.so配置到环境变量里,并且最好加到配置文件里面,这样长期有效

[root@localhost ~]# echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/libssl.so >> /etc/profile

[root@localhost ~]# source /etc/profile

如果profile文件中,添加的环境变量路径有:,需要去掉,如下图:

4,需要的不同版本的OpenSSL库文件,可以在此下载:

https://github.com/IndySockets/OpenSSL-Binaries

到此结束!

需要先安装Patch1。 Patch 2 for RAD Studio 10.4 now available This patch addresses a number of issues in RAD Studio 10.4, pertaining to Delphi Compiler, the RAD Studio IDE in general and the new LSP-based Code Insight in particular, plus C++ Builder Android exceptions and some debugger issues. The installation of this patch requires a prior installation of Patch #1 (separately available on GetIt and in the download portal). Installing this patch is recommended for all RAD Studio 10.4 customers. Note that this patch is fairly large to download (around 190 MB). The patch includes detailed installation instructions as part of the Readme. Please read the steps carefully (or the corresponding steps in this blog post), as the GetIt download does not install the patch automatically. You must follow the instructions in order to install. Just using GetIt is not enough. List of Customer Reported Issues Addressed in 10.4 Patch 2 RAD Studio 10.4 Patch #2 addresses the following issues reported by customer on Embarcadero Quality Portal (https://quality.embarcadero.com): RSP-29628 VCL Grids bug RSP-29560 [REGRESSION] Misalignment in TStringGrid, StretchDraw method in OnDrawCell RSP-29412 Compiler generates incorrect code for if-then RSP-29402 Delphi 10.4 TStringGrid.OnDrawCell bug RSP-29374 Wrong rect coords in TStringGridDrawCell, so image are drawn at wrong position RSP-29347 [DelphiLSP] IDE Crashes when view form as text is selected and running LSP server RSP-29310 Internal error L891 when linking because of complex types based on records with class var RSP-29299 CODEGEN bug in managed fields initialization, associated with new management operators. RSP-29271 [DelphiLSP] Code Insight adds unneeded () when changing procedures/functions RSP-29256 Compiler generates wrong code for template function RSP-29227 Incorrect property value obtained from the record RSP-29226 Access violation with working code under 10.2 RSP-29218 compiling static library under Android error E4620 processing resource .fmx -2 raised RSP-29172 Access Violation when opening License Manager RSP-29142 GoTo statements not working RSP-29136 Dialog constantly pops up during debugging RSP-29129 iOS App simply crashes with a TWebBrowser on it. RSP-29127 Compiler internal error if you ignore the result of a function that returns a generic record RSP-29124 ICE E1812 RSP-28989 License Manager has access violation error when i click on Workstation Licenses RSP-28887 Space does not finish code completion RSP-28857 Default(T) generates bad code for managed record RSP-28821 [Regression] TStringGrid.OnDrawCell parameter Rect contains wrong values RSP-28808 Project options dialog page "Delphi Compiler" is not populated when opening the dialog RSP-28796 RVO for M-records: initialisation of local variables RSP-28761 [REGRESSION] E2154 Type 'T' needs finalization - not allowed in variant record RSP-28737 Compiler error when inlining new Bit Counting Standard Functions RSP-28735 Managed Records Causing Internal Compiler Error RSP-28717 Delphi Package fails to compile RSP-28701 Bind visually on TDBGRID kills the IDE RSP-28669 [BadCG] Value M-record parameters: improper AddRefRecord RSP-28659 RVO for M-records: assignment to local variables RSP-28616 [BadCG] Operator Assign should not allow non-default calling conventions RSP-28615 [BadCG] In the absence of Initialize, finalisation is not guaranteed for local variables RSP-28552 Poor code generation for local managed record variables RSP-28499 Options - Translation tools - Font - Corrupted? RSP-28476 LSP ErrorInsight in Structure Pane only shows one keystroke after editor RSP-28400 [BadCG] Operator Assign is not always invoked for fields RSP-28372 [Regression] Bad codegen in function returning generic type RSP-27268 C++ Builder 10.3.3 Android Exceptions RSP-27251 Internal error when trying to inline with optimization on RSP-24079 Package version is broken RSP-23403 Build for linux 64 error RSP-23024 Record helper class constructor gives senseless compiler warning RSP-22318 Pointer type check missed when object field is a dynarray RSP-21554 Compiler generates incorrect code for parameterized record type RSP-21248 Const dynamic array unexpectedly contains uninitialized data RSP-20372 A generic "reference to function" will only match the first of several overloaded functions RSP-19714 Win32 compiler - Memory corruption with array helpers RSP-18241 *.c source files, added to C++ project, got added to DeploymentManager file list RSP-18148 AV in TList.Remove (64-bit compiler only)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值