From: Brett W. McCoy <bmccoy@lan2wan.com>
To: Atika <agoswa@essex.ac.uk>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] INSERT query (using insert from a Java application, concerning String input)
Date: Wed, 17 Feb 1999 19:22:59 -0500 (EST)
Message-ID: <Pine.BSI.3.91.990217191629.22885D-100000@access1.lan2wan.com> (raw)
In-Reply-To: <Pine.OSF.4.03.9902172108360.6790-100000@seralph15.essex.ac.uk>
On Wed, 17 Feb 1999, Atika wrote:
> String input = "This is a String";
>
> myConn.updateQuery("insert into myDB values(input)");
>
> but get an error when I run it saying:
> ERROR: attribute input not found
> java.sql.SQLException: ERROR: attribute input not found
>
> I am also going to have to insert integer and other such values but am not
> going to know their values when I use the insert statement.
I don't know the details of the Java interface (perhaps you should pose
your question to the interfaces list?), but you still need the single
quotes else the term ends up in the SQL querytree as an attribute rather
than as data to insert into an attribute. All of the language interfaces
I have used still require the single quotes, even if you are
interpolating string variables inside of the SQL statement. Or is the
JDBC completely different in this? Can you prepare your query string
beforehand and then pass the entire string as a varaible rather than as
a literal to the updateQuery method?
Brett W. McCoy
http://www.lan2wan.com/~bmccoy
-----------------------------------------------------------------------
Labor, n.:
One of the processes by which A acquires property for B.
-- Ambrose Bierce, "The Devil's Dictionary"
----- BEGIN GEEK CODE BLOCK -----
Version: 3.12
GAT dpu s:-- a C++++ UL++++$ P+ L+++ E W++ N- o K- w--- O@ M-@ !V PS+++
PE Y+ PGP- t++ 5- X+ R+@ tv b+++ DI+++ D+ e>++ h+ r++ y++++
------ END GEEK CODE BLOCK ------
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-sql@postgresql.org
Cc: bmccoy@lan2wan.com, agoswa@essex.ac.uk
Subject: Re: [SQL] INSERT query (using insert from a Java application, concerning String input)
In-Reply-To: <Pine.BSI.3.91.990217191629.22885D-100000@access1.lan2wan.com>
References: <Pine.OSF.4.03.9902172108360.6790-100000@seralph15.essex.ac.uk> <Pine.BSI.3.91.990217191629.22885D-100000@access1.lan2wan.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