pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedSQLException from Postgres JDBC
5+ messages / 4 participants
[nested] [flat]
* SQLException from Postgres JDBC
@ 2000-09-28 14:27 Daniel Gayo Avello <danielgayo@terra.es>
2000-09-28 14:41 ` Re: SQLException from Postgres JDBC Jens Carlberg <jenca@lysator.liu.se>
2000-09-28 14:50 ` Re: SQLException from Postgres JDBC Michael Stephenson <mstephenson@tirin.openworld.co.uk>
2000-09-28 16:00 ` Re: SQLException from Postgres JDBC Peter Mount <peter@retep.org.uk>
0 siblings, 3 replies; 5+ messages in thread
From: Daniel Gayo Avello @ 2000-09-28 14:27 UTC (permalink / raw)
To: pgsql-interfaces
Hi, everybody! I've got a problem with Postgres JDBC driver and perhaps somebody could help me. I'm using JDK 1.2.2, JSK 2.0, PostgreSQL 7.0.2 and Apache JServ 1.1.2 and my servlets throw a SQLException when I try to perform a INSERT or DELETE operation...
In fact, the operations are done but they don't return any results so a exception is catch by the servlet.
Does somebody know the way to avoid this?
Thanks in advance, Dani
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: SQLException from Postgres JDBC
2000-09-28 14:27 SQLException from Postgres JDBC Daniel Gayo Avello <danielgayo@terra.es>
@ 2000-09-28 14:41 ` Jens Carlberg <jenca@lysator.liu.se>
2000-09-28 14:56 ` RE: SQLException from Postgres JDBC Daniel Gayo Avello <danielgayo@terra.es>
2 siblings, 1 reply; 5+ messages in thread
From: Jens Carlberg @ 2000-09-28 14:41 UTC (permalink / raw)
To: ; +Cc: pgsql-interfaces
> Daniel Gayo Avello wrote:
>
> Hi, everybody! I've got a problem with Postgres JDBC driver and
> perhaps somebody could help me. I'm using JDK 1.2.2, JSK 2.0,
> PostgreSQL 7.0.2 and Apache JServ 1.1.2 and my servlets throw a
> SQLException when I try to perform a INSERT or DELETE operation...
Hi!
It is hard to comment when you dont supply any example code that
demonstrates your problem. If you could send a code block in which the
error occurs it would be much easier.
> In fact, the operations are done but they don't return any results so
> a exception is catch by the servlet.
Do this means that the data is inserted/deleted, even though you get an
exception? Then I would guess you handle the returned result in the
wrong way, or something like it.
///Jens Carlberg
^ permalink raw reply [nested|flat] 5+ messages in thread
* RE: SQLException from Postgres JDBC
2000-09-28 14:27 SQLException from Postgres JDBC Daniel Gayo Avello <danielgayo@terra.es>
2000-09-28 14:41 ` Re: SQLException from Postgres JDBC Jens Carlberg <jenca@lysator.liu.se>
@ 2000-09-28 14:56 ` Daniel Gayo Avello <danielgayo@terra.es>
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Gayo Avello @ 2000-09-28 14:56 UTC (permalink / raw)
To: pgsql-interfaces
Thanks both of you (Jens and Peter), yes, I'm using executeQuery and should
be executeUpdate()... Newbie mistakes.
Thanks again. Dani
> > In fact, the operations are done but they don't return any results so
> > a exception is catch by the servlet.
>
> Do this means that the data is inserted/deleted, even though you get an
> exception? Then I would guess you handle the returned result in the
> wrong way, or something like it.
>
> ///Jens Carlberg
> Which method are you using to perform the INSERT or DELETE?
>
> You should be using executeUpdate() rather than executeQuery() because
> executeUpdate() doesn't expect a ResultSet to be returned, and
> executeQuery should throw an SQLException when it fails to get one.
>
> Peter
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: SQLException from Postgres JDBC
2000-09-28 14:27 SQLException from Postgres JDBC Daniel Gayo Avello <danielgayo@terra.es>
@ 2000-09-28 14:50 ` Michael Stephenson <mstephenson@tirin.openworld.co.uk>
2 siblings, 0 replies; 5+ messages in thread
From: Michael Stephenson @ 2000-09-28 14:50 UTC (permalink / raw)
To: ; +Cc: pgsql-interfaces
> Hi, everybody! I've got a problem with Postgres JDBC driver and
> perhaps somebody could help me. I'm using JDK 1.2.2, JSK 2.0,
> PostgreSQL 7.0.2 and Apache JServ 1.1.2 and my servlets throw a
> SQLException when I try to perform a INSERT or DELETE operation...
>
> In fact, the operations are done but they don't return any results so
> a exception is catch by the servlet.
Just guessing because your description is so vague..
If you use executeQuery instead of executeUpdate you'll get the exception
postgresql.stat.noresult, which seems to be fit with what you're
describing.
Michael Stephenson
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: SQLException from Postgres JDBC
2000-09-28 14:27 SQLException from Postgres JDBC Daniel Gayo Avello <danielgayo@terra.es>
@ 2000-09-28 16:00 ` Peter Mount <peter@retep.org.uk>
2 siblings, 0 replies; 5+ messages in thread
From: Peter Mount @ 2000-09-28 16:00 UTC (permalink / raw)
To: Daniel Gayo Avello <danielgayo@terra.es>; +Cc: pgsql-interfaces
On Thu, 28 Sep 2000, Daniel Gayo Avello wrote:
> Hi, everybody! I've got a problem with Postgres JDBC driver and
> perhaps somebody could help me. I'm using JDK 1.2.2, JSK 2.0,
> PostgreSQL 7.0.2 and Apache JServ 1.1.2 and my servlets throw a
> SQLException when I try to perform a INSERT or DELETE operation...
>
> In fact, the operations are done but they don't return any results so
> a exception is catch by the servlet.
>
> Does somebody know the way to avoid this?
Which method are you using to perform the INSERT or DELETE?
You should be using executeUpdate() rather than executeQuery() because
executeUpdate() doesn't expect a ResultSet to be returned, and
executeQuery should throw an SQLException when it fails to get one.
An alternative (if you don't know what the query will be) is execute(),
but you then have to handle ResultGet accordingly.
Peter
--
Peter T Mount peter@retep.org.uk http://www.retep.org.uk
PostgreSQL JDBC Driver http://www.retep.org.uk/postgres/
Java PDF Generator http://www.retep.org.uk/pdf/
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2000-09-28 16:00 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-09-28 14:27 SQLException from Postgres JDBC Daniel Gayo Avello <danielgayo@terra.es>
2000-09-28 14:41 ` Jens Carlberg <jenca@lysator.liu.se>
2000-09-28 14:56 ` Daniel Gayo Avello <danielgayo@terra.es>
2000-09-28 14:50 ` Michael Stephenson <mstephenson@tirin.openworld.co.uk>
2000-09-28 16:00 ` Peter Mount <peter@retep.org.uk>
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