pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Gamache <cgamache@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: stringtype=unspecified problem
Date: Wed, 14 Feb 2007 14:29:06 -0500
Message-ID: <9cc55f600702141129l152d6e68i8c32fa0bb11bc788@mail.gmail.com> (raw)
In-Reply-To: <45CED295.8050808@opencloud.com>
References: <9cc55f600702091415r22648579uf5bc0d00e4c9932b@mail.gmail.com>
	<45CED295.8050808@opencloud.com>

Here's a test case... Since I'm handling these UUIDs as Strings
throughout the java code, they are indistinguishable from an actual
string.

/*
 * CREATE TABLE bomb_test (uuid uniqueidentifier);
 */

try {
       DriverManager.registerDriver(new org.postgresql.Driver());
       Connection conn =
DriverManager.getConnection("jdbc:postgresql://10.10.0.1:5432/data/public?stringtype=unspecified","postgres","password");
       PreparedStatement bombOnNull = conn.prepareStatement("INSERT INTO
bomb_test (uuid) values (?)");
       //bombOnNull.setString(1, UUID.randomUUID().toString()); //this works
       //bombOnNull.setString(1, null); //this works
       //bombOnNull.setNull(1, java.sql.Types.NULL); //this works
       //bombOnNull.setNull(1, java.sql.Types.OTHER); //this works
       bombOnNull.setNull(1, java.sql.Types.VARCHAR); //this bombs
       bombOnNull.executeUpdate();
       bombOnNull.close();
       conn.close();
} catch (Exception e) {
       e.printStackTrace();
}

Thank you for taking a look!

On 2/11/07, Oliver Jowett <oliver@opencloud.com> wrote:
> Chris Gamache wrote:
>
> > I'm running into a problem when I want to explicitly set one of those
> > unspecified types to NULL.
>
> How exactly are you doing this, in terms of JDBC API calls? A testcase
> showing the problem would be useful.
>
> -O
>



view thread (6+ messages)  latest in thread

Message-ID: <9cc55f600702141129l152d6e68i8c32fa0bb11bc788@mail.gmail.com>
Permalink:  ../9cc55f600702141129l152d6e68i8c32fa0bb11bc788@mail.gmail.com/
Also on:    postgresql.org/message-id/9cc55f600702141129l152d6e68i8c32fa0bb11bc788@mail.gmail.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: cgamache@gmail.com
  Subject: Re: stringtype=unspecified problem
  In-Reply-To: <9cc55f600702141129l152d6e68i8c32fa0bb11bc788@mail.gmail.com>
  References: <9cc55f600702091415r22648579uf5bc0d00e4c9932b@mail.gmail.com> <45CED295.8050808@opencloud.com> <9cc55f600702141129l152d6e68i8c32fa0bb11bc788@mail.gmail.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