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

Re: [INTERFACES] Problem with PreparedStatement

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: "Esteban Chiner Sanz" <echiner(at)tissat(dot)es>
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] Problem with PreparedStatement
Date: 1999-10-18 18:22:56
Message-ID: 199910181822.TAA00590@linda.lfix.co.uk (view raw or flat)
Thread:
Lists: pgsql-interfaces
"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 could be the problem? I've tried everything and I haven't found the
  >solution yet. Please, help.
  >Thanks in advance,
 
How about:
    sql="insert into tar_historico values ('?','?','?')";

-- 
      Vote against SPAM: http://www.politik-digital.de/spam/
                 ========================================
Oliver Elphick                                Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight                              http://www.lfix.co.uk/oliver
               PGP key from public servers; key ID 32B8FAA1
                 ========================================
     "Delight thyself also in the LORD; and he shall give 
      thee the desires of thine heart."          Psalms 37:4



In response to

pgsql-interfaces by date

Next:From: Bruce StephensDate: 1999-10-18 19:25:29
Subject: Re: [INTERFACES] Support for Tcl/Tk 8.2
Previous:From: Gerhard HintermayerDate: 1999-10-18 18:18:31
Subject: Support for Tcl/Tk 8.2

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