pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedJDBC problem with DELETE
9+ messages / 5 participants
[nested] [flat]
* JDBC problem with DELETE
@ 2000-07-27 04:41 Dnesbitt@encryptix.com
2000-07-27 07:56 ` Re: JDBC problem with DELETE Cedar Cox <cedarc@visionforisrael.com>
0 siblings, 1 reply; 9+ messages in thread
From: Dnesbitt@encryptix.com @ 2000-07-27 04:41 UTC (permalink / raw)
To: pgsql-interfaces; +Cc: Dnesbitt@encryptix.com
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,
//Dave
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: JDBC problem with DELETE
2000-07-27 04:41 JDBC problem with DELETE Dnesbitt@encryptix.com
@ 2000-07-27 07:56 ` Cedar Cox <cedarc@visionforisrael.com>
0 siblings, 0 replies; 9+ messages in thread
From: Cedar Cox @ 2000-07-27 07:56 UTC (permalink / raw)
To: Dnesbitt@encryptix.com; +Cc: pgsql-interfaces
Let me answer this one... ;)
> stmt.executeUpdate("delete from friend where name='"+someName+"'");
>
> SQLException: java.sql.SQLException: ERROR: Attribute 'John Doe' not
> found
Remember that an 'Attribute' is a "field" in PG. PG is taking this as
WHERE fieldname "name" = fieldname "someName"; PG is somehow receiving
double quotes around 'someName'. I don't do java, so you figure this one
out..
Change the quoting on someName to single quotes and it should
work. Single quotes aroung strings, double quotes around field
names. Note that double quotes around field or table names are only
required if you need to preserve uppercase letters in the name.
(..someone correct me if I'm not right about this...)
-Cedar
^ permalink raw reply [nested|flat] 9+ messages in thread
* RE: JDBC problem with DELETE
@ 2000-07-27 06:48 Peter Mount <petermount@it.maidstone.gov.uk>
0 siblings, 0 replies; 9+ messages in thread
From: Peter Mount @ 2000-07-27 06:48 UTC (permalink / raw)
To: 'Dnesbitt@encryptix.com' <Dnesbitt@encryptix.com>; pgsql-interfaces
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,
//Dave
^ permalink raw reply [nested|flat] 9+ messages in thread
* RE: JDBC problem with DELETE
@ 2000-07-27 16:55 Dnesbitt@encryptix.com
2000-07-27 17:51 ` Re: JDBC problem with DELETE Peter Mount <peter@retep.org.uk>
0 siblings, 1 reply; 9+ messages in thread
From: Dnesbitt@encryptix.com @ 2000-07-27 16:55 UTC (permalink / raw)
To: petermount@it.maidstone.gov.uk; pgsql-interfaces; +Cc: Dnesbitt@encryptix.com
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,
//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,
> //Dave
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: JDBC problem with DELETE
2000-07-27 16:55 RE: JDBC problem with DELETE Dnesbitt@encryptix.com
@ 2000-07-27 17:51 ` Peter Mount <peter@retep.org.uk>
0 siblings, 0 replies; 9+ messages in thread
From: Peter Mount @ 2000-07-27 17:51 UTC (permalink / raw)
To: Dnesbitt@encryptix.com; petermount@it.maidstone.gov.uk; pgsql-interfaces; +Cc: Dnesbitt@encryptix.com
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
> >
^ permalink raw reply [nested|flat] 9+ messages in thread
* RE: JDBC problem with DELETE
@ 2000-07-29 02:09 Dnesbitt@encryptix.com
0 siblings, 0 replies; 9+ messages in thread
From: Dnesbitt@encryptix.com @ 2000-07-29 02:09 UTC (permalink / raw)
To: peter@retep.org.uk; petermount@it.maidstone.gov.uk; pgsql-interfaces; +Cc: Dnesbitt@encryptix.com
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
> > >
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* RE: JDBC problem with DELETE
@ 2000-07-31 06:47 Peter Mount <petermount@it.maidstone.gov.uk>
0 siblings, 0 replies; 9+ messages in thread
From: Peter Mount @ 2000-07-31 06:47 UTC (permalink / raw)
To: 'Dnesbitt@encryptix.com' <Dnesbitt@encryptix.com>; Peter Mount (Home) <peter@retep.org.uk>; Peter Mount <petermount@it.maidstone.gov.uk>; pgsql-interfaces
PreparedStatement is the proper way, because it allows for differences
between implementations of SQL and how data types are handled. It's mainly
for code that can use different database engines.
ie: setString() will automatically add quotes whereas you have to do this
yourself with Statement. Also, not all quotes are '. There's a method in
DatabaseMetaData that returns the current quoting character (which we hard
code to '). This allows some engines to use different characters.
Also when you start using some of the more special types, PreparedStatement
will handle them better than you could - look at
setTimestamp()/getTimestamp() for an example... It's easier to keep the
driver in line with the backend (the format returned changed) than to change
everyone's code.
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: Saturday, July 29, 2000 3:09 AM
To: peter@retep.org.uk; petermount@it.maidstone.gov.uk;
pgsql-interfaces@postgresql.org
Cc: Dnesbitt@encryptix.com
Subject: RE: [INTERFACES] JDBC problem with DELETE
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
> > >
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* RE: JDBC problem with DELETE
@ 2000-07-31 16:12 Dwelle, Timothy <TDwelle@xperts.com>
0 siblings, 0 replies; 9+ messages in thread
From: Dwelle, Timothy @ 2000-07-31 16:12 UTC (permalink / raw)
To: 'Dnesbitt@encryptix.com' <Dnesbitt@encryptix.com>; peter@retep.org.uk; petermount@it.maidstone.gov.uk; pgsql-interfaces
Dave,
Um... just thought I'd ask...
Are you really using "John Doe" (as in the email)
or is that just a dummy placeholder for the real
names you inserted?
The reason why I ask is that I remember the first
time I was bit by the ole single quote problem was
dealing with an 'O'Connor' that, of course, really
should have been an 'O''Connor'. Thought maybe
something similar was happening here...
-Tim.
-----Original Message-----
From: Dnesbitt@encryptix.com [mailto:Dnesbitt@encryptix.com]
Sent: Friday, July 28, 2000 10:09 PM
To: peter@retep.org.uk; petermount@it.maidstone.gov.uk;
pgsql-interfaces@postgresql.org
Cc: Dnesbitt@encryptix.com
Subject: RE: [INTERFACES] JDBC problem with DELETE
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
> > >
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* RE: JDBC problem with DELETE
@ 2000-08-01 00:13 Dnesbitt@encryptix.com
0 siblings, 0 replies; 9+ messages in thread
From: Dnesbitt@encryptix.com @ 2000-08-01 00:13 UTC (permalink / raw)
To: TDwelle@xperts.com; peter@retep.org.uk; petermount@it.maidstone.gov.uk; pgsql-interfaces; +Cc: Dnesbitt@encryptix.com
Tim,
It is not really "John Doe", but it also does not have any embedded single
quotes. It does, however, have an embedded space character. I don't know
if this has anything to do with it, but it is the only thing I can think of
that is different than line 380 in Peter's example file ImageViewer.java.
Regards,
//Dave
> -----Original Message-----
> From: Dwelle, Timothy [mailto:TDwelle@xperts.com]
> Sent: Monday, July 31, 2000 9:13 AM
> To: 'Dnesbitt@encryptix.com'; peter@retep.org.uk;
> petermount@it.maidstone.gov.uk; pgsql-interfaces@postgresql.org
> Subject: RE: [INTERFACES] JDBC problem with DELETE
>
>
> Dave,
>
> Um... just thought I'd ask...
>
> Are you really using "John Doe" (as in the email)
> or is that just a dummy placeholder for the real
> names you inserted?
>
> The reason why I ask is that I remember the first
> time I was bit by the ole single quote problem was
> dealing with an 'O'Connor' that, of course, really
> should have been an 'O''Connor'. Thought maybe
> something similar was happening here...
>
> -Tim.
>
>
> -----Original Message-----
> From: Dnesbitt@encryptix.com [mailto:Dnesbitt@encryptix.com]
> Sent: Friday, July 28, 2000 10:09 PM
> To: peter@retep.org.uk; petermount@it.maidstone.gov.uk;
> pgsql-interfaces@postgresql.org
> Cc: Dnesbitt@encryptix.com
> Subject: RE: [INTERFACES] JDBC problem with DELETE
>
>
> 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
> > > >
> >
>
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2000-08-01 00:13 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-07-27 04:41 JDBC problem with DELETE Dnesbitt@encryptix.com
2000-07-27 07:56 ` Cedar Cox <cedarc@visionforisrael.com>
2000-07-27 06:48 RE: JDBC problem with DELETE Peter Mount <petermount@it.maidstone.gov.uk>
2000-07-27 16:55 RE: JDBC problem with DELETE Dnesbitt@encryptix.com
2000-07-27 17:51 ` Peter Mount <peter@retep.org.uk>
2000-07-29 02:09 RE: JDBC problem with DELETE Dnesbitt@encryptix.com
2000-07-31 06:47 RE: JDBC problem with DELETE Peter Mount <petermount@it.maidstone.gov.uk>
2000-07-31 16:12 RE: JDBC problem with DELETE Dwelle, Timothy <TDwelle@xperts.com>
2000-08-01 00:13 RE: JDBC problem with DELETE Dnesbitt@encryptix.com
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