I have a project in C# using DavArt dotConnector to connect to PostgreSQL database. In database I can add role to use it in connection string.

CREATE ROLE "Z111222333";
ALTER ROLE "Z111222333" WITH NOCREATEROLE LOGIN PASSWORD 'md5c6fd41ba62fc5ce98135f0707de385ba';

With Latin characters in the name all goes right. User can connect.
I try to create role with non-Latin characters (e.g. Cyrillic).

CREATE ROLE "ZФРОЛОВМ";
ALTER ROLE "ZФРОЛОВМ" WITH NOCREATEROLE LOGIN PASSWORD 'md5b4b194033aab1f2d6dbd275736f1b029';

In this case user can't connect. Exception: "Error: 28P01: password authentication failed for user "ZФРОЛОВМ"".

Connector: Devart dotConnector for PostgreSQL 6.5
Database: PostgreSQL 9.1
Connection string: "User Id=ZФРОЛОВМ;Password=A1E0476879CAB2A76CC22C80BBF364; Host=localhost;Database=testDB;Unicode=True;Persist Security Info=True;Schema=mir"

How can I use non-Latin characters in the UserId?

有帮助吗?

解决方案

Using non-ASCII characters in user names (and database names) is best avoided in PostgreSQL. During the initial connection setup and authentication, character encoding conversion is not active, and the success of the connection will then depend on whether you happen to send the right bytes in the right encoding. I don't know whether that's the problem in your case, but it wouldn't surprise me, and it wouldn't surprise me if there are other similar problems.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top