pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Ledesma <aledes@euskalnet.net>
To: pgsql-jdbc@postgresql.org
Subject: postgresql and java data types mismatch.....
Date: Thu, 11 Aug 2005 13:23:42 +0000
Message-ID: <200508111323.42615.aledes@euskalnet.net> (raw)

Hi,

I have got and issue about data types, perhaps I'm missing some info I should 
know, or there is anything wrong in the code, but I would like that if 
someone knows why this happens, ust explain it to me.

According to documentation, java.sql.Types.BOOLEAN is the equivalence of SQL 
BOOLEAN, but a function returning a boolean, returns something matched to 
Types.BIT in java.  It happens in the following code.

java code:
 ....... vars declarations, etc...
    boolean is_client = false;
  
            //procedure call
            cs = conn.prepareCall("{ ? = call get_is_client( ? ) }");

            cs.registerOutParameter(1, Types.BOOLEAN);
            cs.setInt(2, client_id);
            cs.execute();
           
    is_client = cs.getBoolean(1);

 .....
plpgsql function :

 CREATE OR REPLACE FUNCTION get_is_client() RETURNS boolean AS '
 BEGIN
      RETURN is_true;
 END;
 ' LANGUAGE plpgsql;

When run the java code, I receive the following message :

A CallableStatement Function was executed and the return was of type 
(java.sql.Types=-7) however type=java.sql.Types=16 was registered.

Types = -7 correspond to Types.BIT
Types = 16 correspond to Types.BOOLEAN


That's all. Thanks in advance. 

Best regards.

-- 

Andres Ledesma
=================



view thread (4+ messages)  latest in thread

Message-ID: <200508111323.42615.aledes@euskalnet.net>
Permalink:  ../200508111323.42615.aledes@euskalnet.net/
Also on:    postgresql.org/message-id/200508111323.42615.aledes@euskalnet.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: aledes@euskalnet.net
  Subject: Re: postgresql and java data types mismatch.....
  In-Reply-To: <200508111323.42615.aledes@euskalnet.net>
  References: <200508111323.42615.aledes@euskalnet.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox