Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Jdbc > Advice fetching...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 1909 of 1987
Post > Topic >>

Advice fetching Array data with JDBC 8.3 driver

by george.woodring@[EMAIL PROTECTED] ("Woody Woodring") Mar 26, 2008 at 08:53 AM

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


-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
 




 1 Posts in Topic:
Advice fetching Array data with JDBC 8.3 driver
george.woodring@[EMAIL PR  2008-03-26 08:53:32 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Wed Jul 9 0:06:34 CDT 2008.