Advice fetching Array data with JDBC 8.3 driver

Поиск
Список
Период
Сортировка
От Woody Woodring
Тема Advice fetching Array data with JDBC 8.3 driver
Дата
Msg-id 06a801c88f40$6593e7d0$80b1a8c0@istructure.com
обсуждение исходный текст
Ответы Re: Advice fetching Array data with JDBC 8.3 driver  (Kris Jurka <books@ejurka.com>)
Список pgsql-jdbc
Upgrading to the latest 8.3 JDBC driver broke one of our queries (that we
have found) that involves arrays in the database.  Reverting to the latest
8.2 driver fixes it.

The table is:

                                   Table "public.cpe_health"
    Column    |    Type    |                             Modifiers
--------------+------------+------------------------------------------------
-------------------
 cpe_healthid | integer    | not null default
nextval('cpe_health_cpe_healthid_seq'::regclass)
 mac          | macaddr    |
 polldate     | integer    |
 health       | smallint   |
 data         | integer[]  |
 alarm        | smallint[] |

My query is:

SELECT mac, CASE health WHEN 0 THEN 'red' WHEN 1 THEN 'yellow' WHEN 3 THEN
'green' ELSE 'blue' END AS health,
       array_upper(data,1) AS datasize, data, alarm
   FROM cpe_health;

The exception I get is:

java.lang.ClassCastException: [Ljava.lang.Integer;
        at
net.iglass.jglass.cpe.dao.CpeDataDAO$14.handle(CpeDataDAO.java:1018)
        at net.iglass.db.QueryRunner.query(QueryRunner.java:315)
        at net.iglass.db.QueryRunner.query(QueryRunner.java:336)
        at
net.iglass.jglass.cpe.dao.CpeDataDAO.getHealthData(CpeDataDAO.java:1042)

Which line 1018 in my code is:
 int[] hdata = (int[])(rs.getArray("data")).getArray();

Any advice on how to properly fetch the array data in my code would be
appreciated.

Thanks
Woody

----------------------------------------
iGLASS Networks
3300 Green Level Rd. West
Cary NC 27519
(919) 387-3550 x813
www.iglass.net


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

Предыдущее
От: Tore Halset
Дата:
Сообщение: Re: Non-ORM layers over JDBC
Следующее
От: Mark Lewis
Дата:
Сообщение: Re: Non-ORM layers over JDBC