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

Re: [INTERFACES] Problem with PreparedStatement

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: "Esteban Chiner Sanz" <echiner(at)tissat(dot)es>, pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] Problem with PreparedStatement
Date: 1999-10-19 17:16:51
Message-ID: l03130304b432573cdcc7@[147.233.159.109] (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-interfaces
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



In response to

Responses

pgsql-interfaces by date

Next:From: Peter MountDate: 1999-10-19 19:51:13
Subject: Re: [INTERFACES] Problem with PreparedStatement
Previous:From: Sam O'ConnorDate: 1999-10-19 17:15:58
Subject: BUG in ODBC driver

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