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

Re: very interesting JDBC problem ...

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Hans-Jürgen Schönig <postgres(at)cybertec(dot)at>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: very interesting JDBC problem ...
Date: 2004-03-31 21:29:51
Message-ID: 1080768591.10831.270.camel@localhost.localdomain (view raw or flat)
Thread:
Lists: pgsql-jdbc
What do the logs from postgres show ?

Dave
On Wed, 2004-03-31 at 15:31, Hans-Jürgen Schönig wrote:
> Hi everybody,
> 
> I am facing an interesting problem with some JDBC drivers. I am doi9ng 
> some fairly simple SQL:
> 
> 
> microtec=# UPDATE t_consoleserver SET data = data || '021011014504' 
> WHERE procid = '47';
> UPDATE 1
> 
> 
> My program gives me the following logging information:
> 
> 
> [Mar 31, 2004 10:16:01 PM] - 0 - NOTICE: old data in db:
> [Mar 31, 2004 10:16:01 PM] - 0 - NOTICE: adding data to buffer: 
> (021011014504)
> [Mar 31, 2004 10:16:01 PM] - 0 - NOTICE: DSQL: UPDATE t_consoleserver 
> SET data = data || '021011014504' WHERE procid = '57'
> [Mar 31, 2004 10:16:01 PM] - 0 - NOTICE: cannot update data in database: 
> ERROR: invalid message format
> 
> The code is fairly simple:
> 
> 
>                  Elog.Elog("old data in db: " + this.readOnly());
>                  Elog.Elog("adding data to buffer: (" + newdata + ")");
> 
>                  try
>                  {
>                          String dsql = "UPDATE t_consoleserver "
>                                  + "SET data = data || '" + newdata
>                                  + "' WHERE procid = '" + procid + "' ";
>                          Elog.Elog("DSQL: " + dsql);
> 
>                          stmt.executeUpdate(dsql);
>                  }
>                  catch (Exception e)
>                  {
>                          Elog.Elog("cannot update data in database: "
> 				+ e.getMessage());
>                  }
> 
>                  curpos += newdata.length();
> 
> 
> The interesting thing here is that I have used the same code with the 
> JDBC driver which is included in 7.3. It did not work as well but the 
> error message was different. "tail -f postgres_log" told me that only 
> half of the query has been transmitted to the server:
> 
> UPDATE t_consoleserver SET data = data || '021011014504
> 
> The rest has been discarded silently. PostgreSQL complains that there is 
> a syntax error or course.
> Removing "|| '021011014504' " solved the problem and the entire query 
> was transmitted as well.
> 
> By the way: "invalid message format" is sent by build 301.
> Did anybody encounter similar problem?
> I coded SQL statement number 1.0000000000000....000000 in this 
> application but the only statement making use of || seems to cause problems.
> 
> Did anybody encounter similar problems?
> 
> 	Regards,
> 
> 		Hans
-- 
Dave Cramer
519 939 0336
ICQ # 14675561


In response to

Responses

pgsql-jdbc by date

Next:From: Hans-Jürgen SchönigDate: 2004-03-31 21:58:49
Subject: Re: very interesting JDBC problem ...
Previous:From: Hans-Jürgen SchönigDate: 2004-03-31 20:31:02
Subject: very interesting JDBC problem ...

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