Error connecting to PostgreSQL

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for PostgreSQL in Delphi and C++Builder
Post Reply
nelson.cardoso
Posts: 5
Joined: Wed 14 May 2014 12:45

Error connecting to PostgreSQL

Post by nelson.cardoso » Thu 15 May 2014 18:52

Hi,
I have the following problem connecting to PostgreSQL

Conn.DriverName := 'DevartPostgreSQL';
Conn.GetDriverFunc := 'getSQLDriverPostgreSQL';
Conn.LibraryName := 'dbexppgsql.dll';
Conn.LoginPrompt := False;
Conn.VendorLib := 'not used';

Conn.Params.Clear;
Conn.Params.Add('DriverName=DevartPostgreSQL');
Conn.Params.Add('HostName=' + hostNameR.Text);
Conn.Params.Add('DataBase=' + dbNameR.Text);
Conn.Params.Add('User_name=' + userNameR.Text);
Conn.Params.Add('Password=' + passwordR.Text);
Conn.Params.Add('Server Port=' + portR.Text);
Conn.Params.Add('BlobSize=-1');
Conn.Params.Add('FetchAll=True');
Conn.Params.Add('LongStrings=True');
Conn.Params.Add('DetectParamTypes=True');
Conn.Open;

The following error occurs: SQL Server Error: Invalid value for parameter "cliente_encoding": "Win1252"

----------
follow my settings

Postgres version: 9.3
Driver Devart: latest version
Delphi 7
show client_encoding = WIN1252
show server_encoding = UTF8
database accessed: ENCODING = 'LATIN1'

Conn.Params.Add ('client_encoding = LATIN1'); Does not work????


*** Portuguese to English via google translator

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Error connecting to PostgreSQL

Post by AlexP » Fri 16 May 2014 08:40

Hello,

We have already fixed a similar problem, and we can send you a night build in order for you to check this case on your sample. For this, please send your license number to alexp*devart*com.

lfgarrido
Posts: 3
Joined: Wed 29 Oct 2014 19:24

Re: Error connecting to PostgreSQL

Post by lfgarrido » Wed 29 Oct 2014 19:29

Hello, I have the same issue too.

Delphi XE7 trial
Unidac 5.5.12 trial
Client Windows 8.1 64 bits
Server Debian 7 64 bits
PostgreSQL 9.2 64 bits
Database encoding = latin1
lc_collate = 'C'
lc_ctype ='C'
template = template0

When I try to connect shows:
SQL Server Error: Invalid value for parameter "cliente_encoding": "Win1252"

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Error connecting to PostgreSQL

Post by azyk » Fri 31 Oct 2014 09:16

To solve the problem, in the connection properties, set the TUniConnection.SpecificOptions.Values['PostgreSQL.Charset'] option to 'LATIN1'. For example:

Code: Select all

  UniConnection.SpecificOptions.Values['PostgreSQL.Charset'] := 'LATIN1';

lfgarrido
Posts: 3
Joined: Wed 29 Oct 2014 19:24

Re: Error connecting to PostgreSQL

Post by lfgarrido » Wed 12 Nov 2014 16:36

Hello, setting chartset to LATIN1 work, tks

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Error connecting to PostgreSQL

Post by azyk » Fri 14 Nov 2014 06:22

It is good to see that the problem has been solved. Feel free to contact us if you have any further questions.

Post Reply