Thread: postgres jdbc into eclipse plugin (OID problems)
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
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
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
"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