Skip site navigation (1) Skip section navigation (2)

JDBC and Binary protocol error, for some statements

From: Radosław Smogura <rsmogura(at)softperience(dot)eu>
To: PG Hackers <pgsql-hackers(at)postgresql(dot)org>, PostgreSQL JDBC List <pgsql-jdbc(at)postgresql(dot)org>
Subject: JDBC and Binary protocol error, for some statements
Date: 2010-11-24 07:07:07
Message-ID: a7d41aaa473a1a4c38e04796b9f3ac36@smogura-softworks.eu (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-jdbc
Hi,

I work on implementing binary protocol, during test "select ?::int" has
been 
executed few times to compile it to server prepared statement, but after
this 
backend returned field format = text, but sent field data in binary mode.

The parameter is long and is sent to in text mode, with oid 0, as value
"2"
Result is oid=23, format=(0) T, value = 0x00,0x00,0x00,0x02

When I send parameter explicite in binary mode and int4 oid, problem
doesn't 
occurs.

Here is debug of protocol

---------------------------------------
07:52:02.995 (54) simple execute, 
handler=org(dot)postgresql(dot)jdbc2(dot)AbstractJdbc2Statement$StatementResultHandler(at)508aeb74,

maxRows=0, fetchSize=0, flags=17
07:52:02.996 (54)  FE=> Parse(stmt=null,query="SELECT $1::int",oids={0})
07:52:02.996 (54)  FE=> Bind(stmt=null,portal=null,$1=<'2'>)
07:52:02.996 (54)  FE=> Describe(portal=null)
07:52:02.996 (54)  FE=> Execute(portal=null,limit=0)
07:52:02.996 (54)  FE=> Sync
07:52:02.997 (54)  <=BE ParseComplete [null]
07:52:02.997 (54)  <=BE BindComplete [null]
07:52:02.998 (54)  <=BE RowDescription(1)
07:52:02.998 (54)         Field(,INT4,4,B)
07:52:02.998 (54)  <=BE DataRow(len=4)
07:52:02.998 (54)  <=BE CommandStatus(SELECT)
07:52:02.999 (54)  <=BE ReadyForQuery(I)


---------------------------------------
Compiled stat exec
07:52:06.059 (54) simple execute, 
handler=org(dot)postgresql(dot)jdbc2(dot)AbstractJdbc2Statement$StatementResultHandler(at)128ae45a,

maxRows=0, fetchSize=0, flags=16
07:52:06.059 (54)  FE=> Parse(stmt=S_1,query="SELECT $1::int",oids={0})
07:52:06.059 (54)  FE=> Describe(statement=S_1)
07:52:06.060 (54)  FE=> Bind(stmt=S_1,portal=null,$1=<'2'>)
07:52:06.060 (54)  FE=> Execute(portal=null,limit=0)
07:52:06.060 (54)  FE=> Sync
07:52:06.060 (54)  <=BE ParseComplete [S_1]
07:52:06.061 (54)  <=BE ParameterDescription
07:52:06.061 (54)  <=BE RowDescription(1)
07:52:06.061 (54)         Field(,INT4,4,T)
07:52:06.061 (54)  <=BE BindComplete [null]
07:52:06.061 (54)  <=BE DataRow(len=4)
07:52:06.062 (54)  <=BE CommandStatus(SELECT)
07:52:06.062 (54)  <=BE ReadyForQuery(I)
org.postgresql.jdbc4.exceptions.PSQLDataException: Zła wartość dla typu
int: 

Kind regards,
Radek


Responses

pgsql-hackers by date

Next:From: Heikki LinnakangasDate: 2010-11-24 07:10:37
Subject: Re: profiling connection overhead
Previous:From: Tom LaneDate: 2010-11-24 06:15:43
Subject: Re: Suggested "easy" TODO: pg_dump --from-list

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2010-11-24 07:43:17
Subject: Re: getTables() doesn't handle umlauts correctly
Previous:From: Kris JurkaDate: 2010-11-24 06:31:13
Subject: Re: bit datatype and getObject()

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group