Re: stringtype=unspecified problem
| От | Chris Gamache |
|---|---|
| Тема | Re: stringtype=unspecified problem |
| Дата | |
| Msg-id | 9cc55f600702141129l152d6e68i8c32fa0bb11bc788@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: stringtype=unspecified problem (Oliver Jowett <oliver@opencloud.com>) |
| Ответы |
Re: stringtype=unspecified problem
|
| Список | pgsql-jdbc |
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
>
В списке pgsql-jdbc по дате отправления: