Problem with simple SELECT over ODBC

Problem with simple SELECT over ODBC

am 03.09.2010 11:00:45 von Werner Kuhnle

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_0001DB25.4C80D55D
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello,

I am completely new to PostgreSQL and wanted to evaluate PostgreSQL as a =
substitute for MS SQL.
Therefore I installed PG 9 RC and ODBC driver 8.04.02 (ANSI)
The program (EXE) calling the ODBC driver (Windows 32bit written in VC++) =
is using ANSI strings, not Unicode.

When I try the following simple SELECT :

SELECT =
Kurzzeichen,Name_Feld,EURO_Umr_Faktor,NKStellen,RowTimestamp ,RowUserID,RowD=
DMFields,RowID FROM Waehrungen ORDER BY Kurzzeichen
=20
from within pgAdminIII then it works well.

When I use exactly the same query with MS SQL and the SQL Server Native =
Client 10.0 ODBC Driver
it also works well.

But when exactly the same SELECT is issued to PG over the PG ODBC driver =
then I get :

SQLRetcode=3D-1
SqlState=3D42601, NativeError=3D7, MessageText=3DERROR; syntax error at =
=BB,=AB;
=20
Playing around some time with ENCODING=3DWIN1252 instead of UTF-8 and =
trying the UNICODE odbc driver instead of the ANSI driver gives the =
following results:

With the UNICODE driver the message does not occur, but the data returned =
is completely corrupted.

With ENCODING=3DWIN1252 the message is slightly different:
SQLRetcode=3D-1
SqlState=3D42601, NativeError=3D7, MessageText=3DERROR; syntax error at =
»,«;
=20
What's wrong here ?

Thanks in advance for any help/hint.

Greetings

Werner

------_=_NextPart_000_0001DB25.4C80D55D
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



charset=3Diso-8859-1">


leftMargin=3D5 topMargin=3D5 bgColor=3D#e5e5e5>
style=3D"Z-INDEX: 2; POSITION: static; MARGIN-TOP: 17px; WIDTH: 500px; =
FONT-FAMILY: Tahoma,Arial; HEIGHT: 66px; MARGIN-LEFT: 12px; FONT-SIZE: =
10pt"=20
border=3D1 borderColor=3D#ffffff borderColorLight=3D#c0c0c0 =
borderColorDark=3D#c0c0c0=20
cellPadding=3D0 bgColor=3D#ffffff>

borderColor=3D#ffffff>
style=3D"PADDING-BOTTOM: 6px; LINE-HEIGHT: 130%; PADDING-LEFT: 7px; =
PADDING-RIGHT: 6px; VERTICAL-ALIGN: top; PADDING-TOP: 6px"=20
width=3D"100%">


Hello,

 

I am completely new to PostgreSQL and wanted to =
evaluate=20
PostgreSQL as a substitute for MS SQL.

Therefore I installed PG 9 RC and ODBC driver 8.04.02 =

(ANSI)

The program (EXE) calling the ODBC driver (Windows 32bit =
written in=20
VC++) is using ANSI strings, not Unicode.

 

When I try the following simple SELECT :

 

SELECT=20
=
Kurzzeichen,Name_Feld,EURO_Umr_Faktor,NKStellen,RowTimestamp ,RowUserID,RowD=
DMFields,RowID=20
FROM Waehrungen ORDER BY Kurzzeichen
 

from within pgAdminIII then it works well.

 

When I use exactly the same query with MS SQL and the SQL =
Server=20
Native Client 10.0 ODBC Driver

it also works well.

 

But when exactly the same SELECT is issued to PG over the PG =
ODBC=20
driver then I get :


SQLRetcode=3D-1
SqlState=3D42601, NativeError=3D7,=20
MessageText=3DERROR; syntax error at =BB,=AB;
 

Playing around some time with ENCODING=3DWIN1252 instead of =
UTF-8 and=20
trying the UNICODE odbc driver instead of the ANSI driver gives the =

following results:

 

With the UNICODE driver the message does not occur, but the =
data=20
returned is completely corrupted.

 

With ENCODING=3DWIN1252 the message is slightly =
different:

SQLRetcode=3D-1
SqlState=3D42601, NativeError=3D7, =
MessageText=3DERROR;=20
syntax error at »,«;
 

What's wrong here ?

 

Thanks in advance for any help/hint.

 

Greetings

 

Werner

=
 

 


------_=_NextPart_000_0001DB25.4C80D55D--

Re: Problem with simple SELECT over ODBC

am 03.09.2010 16:35:56 von Tom Lane

"Werner Kuhnle" writes:
> But when exactly the same SELECT is issued to PG over the PG ODBC driver then I get :

> SQLRetcode=-1
> SqlState=42601, NativeError=7, MessageText=ERROR; syntax error at »,«;

> Playing around some time with ENCODING=WIN1252 instead of UTF-8 and trying the UNICODE odbc driver instead of the ANSI driver gives the following results:

> With the UNICODE driver the message does not occur, but the data returned is completely corrupted.

> With ENCODING=WIN1252 the message is slightly different:
> SQLRetcode=-1
> SqlState=42601, NativeError=7, MessageText=ERROR; syntax error at »,«;

> What's wrong here ?

No idea, but the first thing I'd try is looking into the server's log to
see what it thought the received query was. Anything that generates an
error would be logged by default.

regards, tom lane

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

Re: Problem with simple SELECT over ODBC

am 03.09.2010 23:53:09 von Hiroshi Inoue

(2010/09/03 18:00), Werner Kuhnle wrote:
>
> Hello,
> I am completely new to PostgreSQL and wanted to evaluate PostgreSQL as =
a
> substitute for MS SQL.
> Therefore I installed PG 9 RC and ODBC driver 8.04.02 (ANSI)
> The program (EXE) calling the ODBC driver (Windows 32bit written in
> VC++) is using ANSI strings, not Unicode.
> When I try the following simple SELECT :
> SELECT
> Kurzzeichen,Name_Feld,EURO_Umr_Faktor,NKStellen,RowTimestamp ,RowUserID,=
RowDDMFields,RowID
> FROM Waehrungen ORDER BY Kurzzeichen
> from within pgAdminIII then it works well.
> When I use exactly the same query with MS SQL and the SQL Server Native
> Client 10.0 ODBC Driver
> it also works well.
> But when exactly the same SELECT is issued to PG over the PG ODBC drive=
r
> then I get :
>
> SQLRetcode=3D-1
> SqlState=3D42601, NativeError=3D7, MessageText=3DERROR; syntax error at=
=BB,=AB;

Could you send me directly the Mylog output?

> Playing around some time with ENCODING=3DWIN1252 instead of UTF-8 and
> trying the UNICODE odbc driver instead of the ANSI driver gives the
> following results:
> With the UNICODE driver the message does not occur, but the data
> returned is completely corrupted.

What do you mean by "corrupted"?
The Unicode driver returns the results in UTF16 strings.

regards,
Hiroshi Inoue

--=20
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc