pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Herouth Maoz <herouth@oumail.openu.ac.il>
To: Esteban Chiner Sanz <echiner@tissat.es>
To: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] Problem with PreparedStatement
Date: Tue, 19 Oct 1999 19:16:51 +0200
Message-ID: <l03130304b432573cdcc7@[147.233.159.109]> (raw)
In-Reply-To: <380B5347.106559E4@tissat.es>

At 19:05 +0200 on 18/10/1999, Esteban Chiner Sanz wrote:


> I'm trying to do this:
>
> if (counter != -1) /* No ha habido ningĂșn error */
>             {
>                 PreparedStatement pstmt=null;
>                 sql="insert into tar_historico values (?,?,?)";
>                 razon="<br>Query: " + sql;
>                 try {
>                     pstmt = con.prepareStatement(sql);
>                     pstmt.setString(1,Integer.toString(counter));
>                     pstmt.setString(2,"1");
>                     pstmt.setTimestamp(3,new Timestamp(new
> java.util.Date().getTime()));
>                     pstmt.executeUpdate(sql);
>                     pstmt.close();
>                     con.close();
>                 }
>
> But I get this error message in the PostgreSQL log:
>
>    query: insert into tar_historico values (?,?,?)
>    ERROR:  parser: parse error at or near ","

What are the (Postgres) datatypes of the fields?

The best would be to know what the final format of the query became. For
this you have to run the postmaster with -d2 or something, to create a
debug-level log. It will show you the statements as they were passed to the
backend.

My personal suspicion is that your first two fields are numeric fields, not
string fields.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma





view thread (4+ messages)  latest in thread

Message-ID: <l03130304b432573cdcc7@[147.233.159.109]>
Permalink:  ../l03130304b432573cdcc7@%5B147.233.159.109%5D/
Also on:    postgresql.org/message-id/l03130304b432573cdcc7@[147.233.159.109]

 · 

reply

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: herouth@oumail.openu.ac.il, echiner@tissat.es
  Subject: Re: [INTERFACES] Problem with PreparedStatement
  In-Reply-To: <l03130304b432573cdcc7@[147.233.159.109]>
  References: <380B5347.106559E4@tissat.es> <l03130304b432573cdcc7@[147.233.159.109]>

* 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