Inserting an array into a table

Поиск
Список
Период
Сортировка
От Jones, Ian (NASC)
Тема Inserting an array into a table
Дата
Msg-id A9DDD195B23AD311BD4B0000F809638E8D8FB3@nems15.nawcad.navy.mil
обсуждение исходный текст
Список pgsql-jdbc
Hello,

I am a little new to JDBC, and am having a little bit of trouble finding a
way to update an array field in a database. I am using the JDBC driver 7.2
which claims to have the built in array support... I believe this, because I
can get an array out of the database and I can materialize it. I cannot
however find a way to modify it and resave it to the database. I either need
to be able to do this, or to simply create an array, and somehow send it to
the database to be inserted programmatically (i.e. I need to use a prepared
statement or the like in a loop).

I have tried the likes of

myPreparedStatement.setObject(1,arrayVariable);

on some recommendations I found online, but this does not seem to work
properly. When I try to use the version of setObject that takes the object
type as a third parameter using Types.ARRAY I get an error message that
claims it did not recognize this value. I also went the route of trying to
materialize they array as a resultSet and modify it, then reinsert the Array
Object returned from the original query. This however does not work either,
as the Array Interface has no method to return an updateable resultSet (or
it least it doesn't seem to).

If anyone has an answer I would really appreciate it. If anyone has a
Correct Answer I would appreciate it even more. As usual, dumb looks are
still free. :)

Thanks,

Ian

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Dave Cramer"
Дата:
Сообщение: Re: build.xml now builds under jdk1.4, checked into cvs
Следующее
От: Benoit Menendez
Дата:
Сообщение: DatabaseMetaData weak implementation