| From: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
|---|---|
| To: | pgsql-jdbc(at)postgresql(dot)org |
| Subject: | Inserting into a uuid column |
| Date: | 2009-03-03 21:07:38 |
| Message-ID: | gok66o$duf$1@ger.gmane.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-jdbc |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kris Jurka | 2009-03-03 21:13:56 | Re: Inserting into a uuid column |
| Previous Message | Віталій Тимчишин | 2009-03-03 13:57:17 | Re: ResultSetMetaData.getColumnDisplaySize returns 2147483647 ? |