pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <davec@fastcrypt.com>
To: Sergey A. Sokolov <abac@xtech.ru>
Cc: Roland Walter <rwa@mosaic-ag.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: BIGINT <-> java.lang.String auto cast
Date: Wed, 25 May 2005 13:49:34 -0400
Message-ID: <4294BAAE.4080106@fastcrypt.com> (raw)
In-Reply-To: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAABJc9hR3hbE6zRuQKvBNvsIKAAAAQAAAA0LbZy9jzwkqkZHEP9P+p2wEAAAAA@xtech.ru>
References: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAABJc9hR3hbE6zRuQKvBNvsIKAAAAQAAAA0LbZy9jzwkqkZHEP9P+p2wEAAAAA@xtech.ru>

I have a patch that I haven't applied yet, but can that will allow you 
to use setObject(n, obj,sqltype) and it will convert obj to the sqltype 
requested as per the spec.

I have been holding back applying this patch but could apply it if this 
will help.

Dave

Sergey A. Sokolov wrote:

>Hello Roland,
>
>Thank you for your prompt reply. I was sure this topic was discussed here
>many times.
>I agree that setLong will solve my problem, as well as doing call to
>"test_proc ( CAST(? AS bigint))".
>
>:)
>
>My point here is that in such an intergation layer as JDBC is, strengthening
>the type-checking will not lead to any good results for end-users of this
>layer (software developers). It will force them to create an another
>database abstraction sublayer.
>
>Imagine tomorrow Postgres team would decide to expand the size of BIGINT
>even more (ok, ok, create another HUGEINT/HUGESERIAL). What class in Java
>should it be mapped to? java.math.BigDecimal? Is there any reason of using
>BigDecimal in your application if you are NOT going to add, subtract,
>multiply or take square root from it?
>
>I think there must be support for String as input and output parameters for
>the most of Postgres datatypes (numeric, date,..). Just my humble opinion.
>
>Sergey Sokolov 
>
>  
>
>>-----Original Message-----
>>From: Roland Walter [mailto:rwa@mosaic-ag.com] 
>>Sent: Wednesday, May 25, 2005 8:54 PM
>>To: Sergey A. Sokolov
>>Cc: pgsql-jdbc@postgresql.org
>>Subject: Re: [JDBC] BIGINT <-> java.lang.String auto cast
>>
>>Sergey A. Sokolov schrieb:
>>    
>>
>>>Hello all,
>>>
>>>I would appreciate if JDBC development team consider my 
>>>      
>>>
>>message as a 
>>    
>>
>>>feature request for Postgres JDBC 8.xx drivers.
>>>
>>>My issue is the following: in our application we use 
>>>      
>>>
>>java.lang.String 
>>    
>>
>>>for holding Identifier values of the database objects (portability, 
>>>extensibility, etc...), while PostgreSQL schema 
>>>      
>>>
>>implementation have ID 
>>    
>>
>>>fields as BIGINT's (or BIGSERIAL's) for most of the objects. We use 
>>>some stored procedures/functions in order to access and modify the 
>>>data and, certainly, have to pass ID values there from Java.
>>>
>>>We use "PreparedStatement.setString(index, id);"-like statements in 
>>>Java for this kind of fields and everything works fine with JDBC 
>>>drivers version 7.4
>>>-- I mean autocast works and stored procedure/function is 
>>>      
>>>
>>being found 
>>    
>>
>>>and called correctly.
>>>When we moved to Postgres JDBC version 8.0, or 8.1dev -- we've ran 
>>>into the problem of getting exceptions like
>>>
>>>org.postgresql.util.PSQLException: ERROR: function 
>>>      
>>>
>>proc_test(character
>>    
>>
>>>varying) does not exist
>>>
>>>      
>>>
>>As I followed this mailinglist, this is a feature of version 
>>8.x and you must use the setXXX-Method that fits the type of 
>>the parameter.
>>
>>In your case setLong(index, id).
>>
>>This feature was introduced to use real Prepared-Statements 
>>with the protocol v3 for client-server-communication of the database.
>>
>>Regards,
>>Roland.
>>    
>>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 7: don't forget to increase your free space map settings
>
>
>  
>



view thread (14+ messages)  latest in thread

Message-ID: <4294BAAE.4080106@fastcrypt.com>
Permalink:  ../4294BAAE.4080106@fastcrypt.com/
Also on:    postgresql.org/message-id/4294BAAE.4080106@fastcrypt.com

 · 

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: davec@fastcrypt.com, abac@xtech.ru, rwa@mosaic-ag.com
  Subject: Re: BIGINT <-> java.lang.String auto cast
  In-Reply-To: <4294BAAE.4080106@fastcrypt.com>
  References: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAABJc9hR3hbE6zRuQKvBNvsIKAAAAQAAAA0LbZy9jzwkqkZHEP9P+p2wEAAAAA@xtech.ru> <4294BAAE.4080106@fastcrypt.com>

* 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