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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-interfaces by date

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