From: Dnesbitt@encryptix.com
To: peter@retep.org.uk
To: petermount@it.maidstone.gov.uk
To: pgsql-interfaces@postgresql.org
Cc: Dnesbitt@encryptix.com
Subject: RE: JDBC problem with DELETE
Date: Fri, 28 Jul 2000 19:09:08 -0700
Message-ID: <19016070071ED411B61300508BAC4B750418CF@exch1etix.encryptix.com> (raw)
Thanks, Peter. Please let me know if you see anything.
I can't see how my Java code could be losing the single quotes. It is such
a simple statement. But then again, I have made obvious coding errors that
I just can't see a time or two in the past. :-)
Why is PreparedStatement the proper safe way? From a coding perspective, it
takes more lines of code and it would seem to also require slightly more
computation as well.
Regards,
//Dave
> -----Original Message-----
> From: Peter Mount [mailto:peter@retep.org.uk]
> Sent: Thursday, July 27, 2000 10:52 AM
> To: Dnesbitt@encryptix.com; petermount@it.maidstone.gov.uk;
> pgsql-interfaces@postgresql.org
> Cc: Dnesbitt@encryptix.com
> Subject: Re: [INTERFACES] JDBC problem with DELETE
>
>
> I'm not sure, but it might be loosing the quote somewhere.
>
> The proper safe way is to use PreparedStatement. I'll try it
> here just to
> make sure it isn't a bug though.
>
> Peter
>
> --
> Peter T Mount peter@retep.org.uk, peter@retepdigital.com,
> me@petermount.com
> Homepage: http://www.retep.org.uk Contact details @
> http://petermount.com
> PostgreSQL JDBC: http://www.retep.org.uk/postgres/
> Java PDF generator: http://www.retep.org.uk/pdf/
>
> ----- Original Message -----
> From: <Dnesbitt@encryptix.com>
> To: <petermount@it.maidstone.gov.uk>;
> <pgsql-interfaces@postgresql.org>
> Cc: <Dnesbitt@encryptix.com>
> Sent: Thursday, July 27, 2000 5:55 PM
> Subject: RE: [INTERFACES] JDBC problem with DELETE
>
>
> > Peter,
> >
> > The sql does work from psql.
> >
> > I also tried your suggestion about using PreparedStatement and that
> worked!
> >
> > Am I doing something wrong with Statement or is it a bug?
> >
> > Regards,
> > file://Dave
> >
> > > -----Original Message-----
> > > From: Peter Mount [mailto:petermount@it.maidstone.gov.uk]
> > > Sent: Wednesday, July 26, 2000 11:48 PM
> > > To: 'Dnesbitt@encryptix.com'; pgsql-interfaces@postgresql.org
> > > Subject: RE: [INTERFACES] JDBC problem with DELETE
> > >
> > >
> > > Does this happen when you run the sql from psql?
> > >
> > > How about using PreparedStatement instead of Statement? It
> > > would then handle
> > > the quoting correctly (which is what I'm thinking is going
> > > wrong here).
> > >
> > > Peter
> > >
> > > --
> > > Peter Mount
> > > Enterprise Support
> > > Maidstone Borough Council
> > > Any views stated are my own, and not those of Maidstone
> > > Borough Council
> > >
> > >
> > > -----Original Message-----
> > > From: Dnesbitt@encryptix.com [mailto:Dnesbitt@encryptix.com]
> > > Sent: Thursday, July 27, 2000 5:41 AM
> > > To: pgsql-interfaces@postgresql.org
> > > Cc: Dnesbitt@encryptix.com
> > > Subject: [INTERFACES] JDBC problem with DELETE
> > >
> > >
> > > The following piece of code:
> > >
> > > stmt.executeUpdate("delete from friend where
> name='"+someName+"'");
> > >
> > > is returning:
> > >
> > > SQLException: java.sql.SQLException: ERROR: Attribute
> > > 'John Doe' not
> > > found
> > >
> > > where someName is "John Doe".
> > >
> > > Any ideas? The row where name='John Doe' is definitely in
> > > the table and I
> > > can execute the statement without problems from psql.
> > >
> > > Thanks in advance for your help.
> > >
> > > Regards,
> > > file://Dave
> > >
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-interfaces@postgresql.org
Cc: Dnesbitt@encryptix.com, peter@retep.org.uk, petermount@it.maidstone.gov.uk
Subject: Re: JDBC problem with DELETE
In-Reply-To: <19016070071ED411B61300508BAC4B750418CF@exch1etix.encryptix.com>
References: <19016070071ED411B61300508BAC4B750418CF@exch1etix.encryptix.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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