How to use unicode with TEntityConnection?

Discussion of open issues, suggestions and bugs regarding EntityDAC
Post Reply
rodrigobarbosa
Posts: 7
Joined: Fri 11 Mar 2016 13:25
Location: Curitiba, Brazil

How to use unicode with TEntityConnection?

Post by rodrigobarbosa » Fri 17 Jun 2016 16:49

Hello everyone,

I use latin charset with unicode, so, have anyone set unicode within the connection string for TEntityConnection?

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

Re: How to use unicode with TEntityConnection?

Post by AlexP » Mon 20 Jun 2016 08:58

Hello,

To work with Unicode characters, you simply need to add the Useunicode parameter in the ConnectionString:

Code: Select all

EntityConnection1.ConnectionString: = EntityConnection1.ConnectionString + '; UseUnicode = True';

rodrigobarbosa
Posts: 7
Joined: Fri 11 Mar 2016 13:25
Location: Curitiba, Brazil

Re: How to use unicode with TEntityConnection?

Post by rodrigobarbosa » Mon 20 Jun 2016 13:18

I have tried and it returns this error message
Connection parameter name is unknown: UseUnicode

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

Re: How to use unicode with TEntityConnection?

Post by AlexP » Tue 21 Jun 2016 09:36

What EntityProvider and database are you using?

rodrigobarbosa
Posts: 7
Joined: Fri 11 Mar 2016 13:25
Location: Curitiba, Brazil

Re: How to use unicode with TEntityConnection?

Post by rodrigobarbosa » Tue 21 Jun 2016 11:27

I use uniDAC connecting to postgres database, don´t know if it matters but the connection changes between two different server with postgres 9.1 and 9.5, but both give me the same message.

I tried change the connection string to use PgDac as found in the documentation, however, the company seens to not have it installed.

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

Re: How to use unicode with TEntityConnection?

Post by AlexP » Mon 27 Jun 2016 08:44

Thank you for the information. We have reproduced the problem in the UniDAC Provider and will try to fix it as soon as possible.

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Re: How to use unicode with TEntityConnection?

Post by bork » Wed 29 Jun 2016 12:25

If you use UniDAC as data provider, you should specify ProviderName, because UniDAC allows connection to various databases. In your case, this connection string is valid:

Code: Select all

EntityConnection.ConnectionString := 'Data Provider=UniDAC;ProviderName=PostgreSQL;SQL Dialect=PostgreSQL;UseUniCode=True;Server=your_server;Port=5432;User=your_user;Password=your_password';
Please specify the connection string that you are using to establish connection via PgDAC.

Isaev
Posts: 5
Joined: Wed 04 Mar 2020 15:06
Location: Dresden

Re: How to use unicode with TEntityConnection?

Post by Isaev » Wed 29 Apr 2020 11:38

Did you fix this problem?
I have PostgreSQLUniProvider and EntityConnection
and if I use UseUniCode=True in EntityConnection.ConnectionString it returns the same message
Connection parameter name is unknown: UseUnicode
and without unicode

Code: Select all

var
  Query: ILinqQueryable;
begin
  Query := Linq.From(EntityContext1['abk']).Select;
  edsABK.SourceCollection := EntityContext1.GetEntities(Query);
  edsABK.Open;
end;
by Open:
character with byte sequence 0xc3 0xbc in encoding "UTF8" has no equivalent in encoding "WIN1251"
Or how can I PgDAC as a EntityConnections DataProvider to use?
In the list of ProviderName I do not see it...

EntityDAC v2.3.4
PostgreSQL 9.6

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: How to use unicode with TEntityConnection?

Post by MaximG » Wed 29 Apr 2020 19:29

As we said earlier, the error is caused by the missing parameter ProviderName, which is required when you use UniDACDataProvider.
Please verify that your connection string contains this parameter:

Code: Select all

EntityConnection.ConnectionString := 'ProviderName=PostgreSQL;Data Provider=UniDAC;SQL Dialect=PostgreSQL;Data Source=...    ...';

Isaev
Posts: 5
Joined: Wed 04 Mar 2020 15:06
Location: Dresden

Re: How to use unicode with TEntityConnection?

Post by Isaev » Thu 30 Apr 2020 09:18

The problem is that we cannot to install at the same time EntityDAC and PgDAC because the both pgdac use, however, different versions of it and they stand always during the conflict!
This prevents you from setting TPgDACDataProvider as a visual component, you have to spell in the code

Code: Select all

EntityConnection1.ProviderName := 'PgDAC';

Post Reply