Hi,
I have a table with a column of type UUID and I would like to import data into
that table.
I'm using a Java based import tool that will use a PreparedStatement and
setObject() (passing a String variable) to insert the data.
The problem is that the import does not work because Postgres throws an error:
"ERROR: column "guid" is of type uuid but expression is of type character varying"
What I don't understand is that doing an insert with a character literal:
INSERT INTO my_table (guid_column, ...)
VALUES
('a0eebc999c0b4ef8bb6d6bb9bd380a11', ...)
works without problems also when used from within Java.
But the following Java code will throw the above error:
PrparedStatement stmt = connection.prepareStatement(
"insert into my_table (guid_column) values (?)");
stmt.setObject(1, "a0eebc999c0b4ef8bb6d6bb9bd380a11");
stmt.executeUpdate();
To me this sounds like a problem with the JDBC driver, or am I missing something?
I'm using PG 8.3.5 on Windows XP, the driver is postgresql-8.3-603.jdbc3.jar
Regards
Thomas