pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
postgres jdbc into eclipse plugin (OID problems)
4+ messages / 3 participants
[nested] [flat]

* postgres jdbc into eclipse plugin (OID problems)
@ 2007-07-11 09:07  Diego Zanga <naarani@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Diego Zanga @ 2007-07-11 09:07 UTC (permalink / raw)
  To: pgsql-jdbc

Lo,

i'm using postgres jdbc (level 3 ver 8.2-505) into an eclipse
plugin (i'm developing the plugin to simplify db creation
/mantainment, inside some projects).

I've a big problem: the server (?!) receive the same
prepared statment as inside the plugin as outside( during
test, without eclipse), but works differently.
If i do it inside the same OID is set to the parameters, but
while inside ECLIPSE the server do not add <"> after and
before string parameters, while OUTSIDE is set the same
OID, and do it.

I've debugged the jdbc driver and the OID is 1043, sended
to the server:
(it's all called from Jdbc3PreparedStatement class)
class : QueryExecutorImpl
method: private void sendQuery( ..... )

here i've seen that at line 700, the OID is sent to the server

        for (int i = 1; i <= params.getParameterCount(); ++i)
            pgStream.SendInteger4(params.getTypeOID(i));

After declaring parameters type to server, there is a BIND
of the effective parameters, done by [line 777]
    private void sendBind(SimpleQuery query, SimpleParameterList
params, Portal portal) throws IOException {

where the parameter is sended with this command:
       params.writeV3Value(i, pgStream);                 // Parameter value

So, it's the Server to manage the parameters type
eventually adding <"> to string, knowing the OID.

However i could not understand WHY, it does it outside
eclipse and not inside it: this means the jdbc driver
have some problems inside eclipse, and doez not
throw execeptions about this problem, so the server
has some problem managing the prepared statement,
but i dont know what is it, and how to debug it


Any hint?

cya
-- 
Diego Zanga
------------------------------
Skype NAARANI
http://www.javablog.eu
http://www.elawoffice.it
http://www.blogstudiolegale.eu



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: postgres jdbc into eclipse plugin (OID problems)
@ 2007-07-12 08:41  Luca Ferrari <fluca1978@infinito.it>
  parent: Diego Zanga <naarani@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Luca Ferrari @ 2007-07-12 08:41 UTC (permalink / raw)
  To: pgsql-jdbc

On Wednesday 11 July 2007 Diego Zanga's cat, walking on the keyboard, wrote:
> However i could not understand WHY, it does it outside
> eclipse and not inside it: this means the jdbc driver
> have some problems inside eclipse, and doez not
> throw execeptions about this problem, so the server
> has some problem managing the prepared statement,
> but i dont know what is it, and how to debug it

I never developed an eclipse plug-ing, thus I don't know exactly how to help 
you (someone with more experience can give you help); I've got only a few 
suggestions. First of all, I guess the problem is in eclipse and not in the 
driver. I think if there's an exception is eclipse that is hiding it to you. 
Moreover, you can set the debugging options in the postgresql.conf 
(client_min_messages and debug_print*) and have a look at the logs to see 
what the server is receiving, as well as you can enable debugging in the 
driver; try appending ?loglevel=2 at the connection URL.

Hope this helps,
Luca



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: postgres jdbc into eclipse plugin (OID problems)
@ 2007-07-12 09:28  Diego Zanga <naarani@gmail.com>
  parent: Luca Ferrari <fluca1978@infinito.it>
  0 siblings, 1 reply; 4+ messages in thread

From: Diego Zanga @ 2007-07-12 09:28 UTC (permalink / raw)
  To: pgsql-jdbc

2007/7/12, Luca Ferrari <fluca1978@infinito.it>:
> On Wednesday 11 July 2007 Diego Zanga's cat, walking on the keyboard, wrote:
> > However i could not understand WHY, it does it outside
> > eclipse and not inside it: this means the jdbc driver
> > have some problems inside eclipse, and doez not
> > throw execeptions about this problem, so the server
> > has some problem managing the prepared statement,
> > but i dont know what is it, and how to debug it
>
> I never developed an eclipse plug-ing, thus I don't know exactly how to help
> you (someone with more experience can give you help); I've got only a few
> suggestions. First of all, I guess the problem is in eclipse and not in the
> driver. I think if there's an exception is eclipse that is hiding it to you.

the problems is probably in my plugin :o)
however i dunno how to fully debug postgres activity
and i've understood why yesterday night :O/

the query i was using was something like:
select tableA.fieldA, tableA.fieldB from tableA where tableA.fieldA=8
the query report an error about >tableA<, but not WHERE/WITCH
tableA word reported the error.

it will be more <friendly> if the error was like

error in tableA:
select tableA.fieldA, tableA.fieldB from tableA where tableA.fieldA
like "tableA"
..............................^

or
error in tableA:
tableA.fieldB from tableA where tableA.fieldA=8

so it's simpler to understand what part of the query seems wrong

> Moreover, you can set the debugging options in the postgresql.conf
> (client_min_messages and debug_print*) and have a look at the logs to see
> what the server is receiving, as well as you can enable debugging in the
> driver; try appending ?loglevel=2 at the connection URL.

i've downloaded the jdbc source and debugged it, in the future
i will enable even this debug options however the problem was
about a prepared statement like
select tableA.fieldA, tableA.fieldB from tableA where tableA.fieldA like ?

while debugging it i thought it <processed> it while receiving, instead
it process it only after the parameter waz received and it has a full
query
select tableA.fieldA, tableA.fieldB from tableA where tableA.fieldA
like "tableA"
the <tableA> he doez not like if the first
select tableA.fieldA,
..........^

(the query i've used is only an example, the one i'm debuggins
is a little long and complex)

thanks :O)
-- 
Diego Zanga
------------------------------
Skype NAARANI
http://www.javablog.eu
http://www.elawoffice.it
http://www.blogstudiolegale.eu



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: postgres jdbc into eclipse plugin (OID problems)
@ 2007-07-12 15:38  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Diego Zanga <naarani@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2007-07-12 15:38 UTC (permalink / raw)
  To: Diego Zanga <naarani@gmail.com>; +Cc: pgsql-jdbc

"Diego Zanga" <naarani@gmail.com> writes:
> the query i was using was something like:
> select tableA.fieldA, tableA.fieldB from tableA where tableA.fieldA=8
> the query report an error about >tableA<, but not WHERE/WITCH
> tableA word reported the error.

Maybe you need to be using a more recent version of Postgres?
I get messages like

regression=# create table foo(x int, y int);
CREATE TABLE
regression=# select foo.x, foo.y, foo.z from foo;
ERROR:  column foo.z does not exist
LINE 1: select foo.x, foo.y, foo.z from foo;
                             ^
regression=#

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2007-07-12 15:38 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-07-11 09:07 postgres jdbc into eclipse plugin (OID problems) Diego Zanga <naarani@gmail.com>
2007-07-12 08:41 ` Luca Ferrari <fluca1978@infinito.it>
2007-07-12 09:28   ` Diego Zanga <naarani@gmail.com>
2007-07-12 15:38     ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox