Skip site navigation (1) Skip section navigation (2)

Problem with PreparedStatement

From: "Esteban Chiner Sanz" <echiner(at)tissat(dot)es>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Problem with PreparedStatement
Date: 1999-10-18 17:05:11
Message-ID: 380B5347.106559E4@tissat.es (view raw or flat)
Thread:
Lists: pgsql-interfaces
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 could be the problem? I've tried everything and I haven't found the
solution yet. Please, help.
Thanks in advance,

            Esteban Chiner
------------------------------------------------------------
 Esteban Chiner Sanz        mailto (work): echiner(at)tissat(dot)es
 TISSAT
 Av. Aragon, 30, 5ÂȘ planta  Phone: 96 393 9950
 Valencia (SPAIN)



Responses

pgsql-interfaces by date

Next:From: Gerhard HintermayerDate: 1999-10-18 18:18:31
Subject: Support for Tcl/Tk 8.2
Previous:From: Dave PageDate: 1999-10-18 15:21:01
Subject: RE: [INTERFACES] ODBC: 'Insufficient base table information for u pdating or refreshing' error with ADO

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group