Received: from shaked.cc.openu.ac.il (shaked.cc.openu.ac.il [147.233.145.65]) by hub.org (8.9.3/8.9.3) with ESMTP id NAA77560 for ; Tue, 19 Oct 1999 13:16:35 -0400 (EDT) (envelope-from herouth@oumail.openu.ac.il) Received: from [147.233.159.109] (herouth@mac-herouth.pc.openu.ac.il [147.233.159.109]) by shaked.cc.openu.ac.il (8.8.8/8.8.8) with ESMTP id TAA14488; Tue, 19 Oct 1999 19:16:27 +0200 (IST) X-Sender: herouth@shaked.cc.openu.ac.il Message-Id: In-Reply-To: <380B5347.106559E4@tissat.es> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Date: Tue, 19 Oct 1999 19:16:51 +0200 To: "Esteban Chiner Sanz" , pgsql-interfaces@postgreSQL.org From: Herouth Maoz Subject: Re: [INTERFACES] Problem with PreparedStatement Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by hub.org id NAA77598 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="
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