Picon
Favicon

Client encoding win866.

Hi.

Can you please tell me how to change client encoding in ODBC?

I tried after a connection to execute SQLExecDirect (stmthp, "set client_encoding to \" WIN866 \ ";", SQL_NTS) , but the encoding is still a win1251.

 

PS: The database I have with encoding win866.  Windows 7. PostgreSQL 9.0.4. psqlodbc-09.00.0200.

 

Mihail Popov.

Hiroshi Inoue | 7 Jun 2011 16:39
Picon

Re: Client encoding win866.

(2011/06/07 20:04), Попов Михаил Юрьевич wrote:
> Hi.
>
> Can you please tell me how to change client encoding in ODBC?
>
> I tried after a connection to execute SQLExecDirect (stmthp, "set
> client_encoding to \" WIN866 \ ";", SQL_NTS) , but the encoding is still
> a win1251.

How do you confirm the client_encoding?

regards,
Hiroshi Inoue

> PS: The database I have with encoding win866.  Windows 7. PostgreSQL
> 9.0.4. psqlodbc-09.00.0200.
>
> Mihail Popov.

--

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Fred Parkinson | 7 Jun 2011 20:16
Favicon

Logging attempt to connect with odbc

Are there any postgresql logs that will tell me why the server is refusing my attempt to create an odbc connection to a database?
I am trying to get to one of our virtual servers with an odbc connection but am refused.
I have other connections to other databases on the same machine, and I thought I duplicated everything from a connecable database to the one I am now trying to connect to, but must have left something out.  Hopefully a database log will tell me what is defective about my attempt to connect.
 
(I browsed through responses to a search on 'server logs' but couldn't find what I need.)
 
Thanks.  Fred
Craig Ringer | 8 Jun 2011 06:57
Picon
Favicon
Gravatar

Re: Logging attempt to connect with odbc

Please read: http://wiki.postgresql.org/wiki/Guide_to_reporting_problems
and try again. Insufficient information.

-- 
Craig Ringer

Tech-related writing at http://soapyfrogs.blogspot.com/

--

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Picon
Favicon

Re: Client encoding win866.


>> Hi.
>>
>> Can you please tell me how to change client encoding in ODBC?
>>
>> I tried after a connection to execute SQLExecDirect (stmthp, "set
>> client_encoding to \" WIN866 \ ";", SQL_NTS) , but the encoding is still
>> a win1251.

> How do you confirm the client_encoding?

Few details...
I create connection and before all the bindings of parameters and columns, and before SQLPrepare I do
SQLExecDirect(stmthp,"set client_encoding to \"WIN866\";",SQL_NTS);
Then after SQLPrepare, SQLBindParameter and after SQLExecute I get an error: 
Error code 22P05 with message ERROR: character 0x83 of encoding "WIN1251" has no equivalent in "MULE_INTERNAL";

In this example, the function I pass the 'select * from "Table"'

regards, Mihail Popov.

--

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Hiroshi Inoue | 8 Jun 2011 15:49
Picon

Re: Client encoding win866.

(2011/06/08 20:52), Попов Михаил Юрьевич wrote:
>
>>> Hi.
>>>
>>> Can you please tell me how to change client encoding in ODBC?
>>>
>>> I tried after a connection to execute SQLExecDirect (stmthp, "set
>>> client_encoding to \" WIN866 \ ";", SQL_NTS) , but the encoding is still
>>> a win1251.
>
>> How do you confirm the client_encoding?
>
> Few details...
> I create connection and before all the bindings of parameters and columns, and before SQLPrepare I do
SQLExecDirect(stmthp,"set client_encoding to \"WIN866\";",SQL_NTS);
> Then after SQLPrepare, SQLBindParameter and after SQLExecute I get an error:
> Error code 22P05 with message ERROR: character 0x83 of encoding "WIN1251" has no equivalent in "MULE_INTERNAL";
>
> In this example, the function I pass the 'select * from "Table"'

What will happen when you don't call *set client_encoding to ...*?

regards,
Hiroshi Inoue

--

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Fred Parkinson | 8 Jun 2011 19:04
Favicon

Re: Logging attempt to connect with odbc

I am using:
postgres odbc version: 7.03.02.00 (been using this successfully for about 10 years)
server version 8.1.22
running on a (virtualized) Suse Linux 10.1 instance
 
Digging into the results of a search on 'log files' I figured out where they are and how to configure server log output (mostly), but cannot interpret the results
 
(new) postgresql.conf settings:
log_error_verbosity = verbose
log_connections = on
log_line_prefix = '%t %d %u %r'
log_min_error_statement = info
log_min_duration_statement = 0
 
Log results of trying to establish an odbc connection from a windos machine:
2011-06-08 07:49:01 PDT [unknown] [unknown] LOG:  00000: connection received: host=172.16.2.42 port=3534  (172.16.2.42 is my windows intranet ip address)
2011-06-08 07:49:01 PDT [unknown] [unknown] LOCATION:  BackendRun, postmaster.c:2712
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOG:  00000: connection authorized: user=postgres database=timecard_development
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOCATION:  BackendRun, postmaster.c:2782
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOG:  00000: duration: 0.162 ms  statement:  
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOCATION:  exec_simple_query, postgres.c:1105
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOG:  00000: duration: 0.689 ms  statement: select version()
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOCATION:  exec_simple_query, postgres.c:1105
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOG:  00000: duration: 0.139 ms  statement: set DateStyle to 'ISO'
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOCATION:  exec_simple_query, postgres.c:1105
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOG:  00000: duration: 0.028 ms  statement: set geqo to 'OFF'
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOCATION:  exec_simple_query, postgres.c:1105
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOG:  00000: duration: 0.058 ms  statement: set extra_float_digits to 2
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOCATION:  exec_simple_query, postgres.c:1105
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOG:  00000: duration: 1.584 ms  statement: select oid from pg_type where typname='lo'
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOCATION:  exec_simple_query, postgres.c:1105
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOG:  00000: duration: 0.130 ms  statement: select pg_client_encoding()
2011-06-08 07:49:01 PDT timecard_development postgres 172.16.2.42(3534)LOCATION:  exec_simple_query, postgres.c:1105
 
 that's it. that's all I get before Windows reports that "a connection could not be made (with) ... the connection parameters..."
Perhaps there is another configuration parameter I can set to get more information, or set the ones described above to something else?
Or perhaps the information I need is here but I can't interpret it?

 All help is greatly appreciated.

Fred
 
 

>>> Craig Ringer <craig <at> postnewspapers.com.au> 06/07/2011 9:57 PM >>>
Please read: http://wiki.postgresql.org/wiki/Guide_to_reporting_problems
and try again. Insufficient information.

--
Craig Ringer

Tech-related writing at http://soapyfrogs.blogspot.com/

--
Sent via pgsql-odbc mailing list (pgsql-odbc <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
Craig Ringer | 9 Jun 2011 06:00
Picon
Favicon
Gravatar

Re: Logging attempt to connect with odbc

On 09/06/11 01:04, Fred Parkinson wrote:

>  that's it. that's all I get before Windows reports that "a connection
> could not be made (with) ... the connection parameters..."

There are no errors in the server-side logs, so I'd be looking at the
client-side ODBC logging.

Turn on ODBC client logging and look at the "mylog" file to see if
there's anything informative. You can enable driver-level logging in the
DSN options using the "MyLog" option; this is **NOT** the same as "ODBC
Logging" which will not tell you what you need to know.

See:

http://psqlodbc.projects.postgresql.org/config.html

http://psqlodbc.projects.postgresql.org/

--
Craig Ringer

--

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Hiroshi Inoue | 9 Jun 2011 11:29
Picon

Re: Client encoding win866.

(2011/06/08 20:52), Попов Михаил Юрьевич wrote:
>
>>> Hi.
>>>
>>> Can you please tell me how to change client encoding in ODBC?
>>>
>>> I tried after a connection to execute SQLExecDirect (stmthp, "set
>>> client_encoding to \" WIN866 \ ";", SQL_NTS) , but the encoding is still
>>> a win1251.
>
>> How do you confirm the client_encoding?
>
> Few details...
> I create connection and before all the bindings of parameters and columns, and before SQLPrepare I do
SQLExecDirect(stmthp,"set client_encoding to \"WIN866\";",SQL_NTS);
> Then after SQLPrepare, SQLBindParameter and after SQLExecute I get an error:
> Error code 22P05 with message ERROR: character 0x83 of encoding "WIN1251" has no equivalent in "MULE_INTERNAL";

Please confirm the database encoding.
Isn't it "WIN1251" not "WIN866"?

regards,
Hiroshi Inoue

--

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Picon
Favicon

Re: Client encoding win866.


>> Few details...
>> I create connection and before all the bindings of parameters and columns, and before SQLPrepare I do
SQLExecDirect(stmthp,"set client_encoding to \"WIN866\";",SQL_NTS);
>> Then after SQLPrepare, SQLBindParameter and after SQLExecute I get an error:
>> Error code 22P05 with message ERROR: character 0x83 of encoding "WIN1251" has no equivalent in "MULE_INTERNAL";
>>
>> In this example, the function I pass the 'select * from "Table"'

>What will happen when you don't call *set client_encoding to ...*?

Yes, I understood and found a bug in my code. And now schema by using "set client_encoding to \"WIN866\";"
worked correctly. Thanks.

But while I was searching for a solution, I found the documentation and tried it through a variable
PGCLIENTENCODING change the encoding.
http://www.postgresql.org/docs/8.1/static/multibyte.html
---
Using PGCLIENTENCODING. If the environment variable PGCLIENTENCODING is defined in the client's
environment, that client encoding is automatically selected when a connection to the server is made.
(This can subsequently be overridden using any of the other methods mentioned above.) 

Using the configuration variable client_encoding. If the client_encoding variable is set, that client
encoding is automatically selected when a connection to the server is made. (This can subsequently be
overridden using any of the other methods mentioned above.)
---
I set environment variable at 'WIN866', as well set the database properties "ALTER DATABASE "DD866" SET
client_encoding='WIN866'". But it did not work. And without *set client_encoding to ...* don't work.
This mechanism would be more optimal for my project, because now, for each cursor must run the command *set
client_encoding to ...*. Or is this another question?

--

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc


Gmane