pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: bond <kirank174@gmail.com>
To: pgsql-sql@postgresql.org
Subject: passing array(java) to postgre sql function
Date: 14 Feb 2006 02:11:20 -0800
Message-ID: <1139911880.531826.81080@f14g2000cwb.googlegroups.com> (raw)

Hi All,

in postgreSql, i have written a function which accepts a String array
and inserts the contents to DB.
when i tested that function by passing the values like:

SELECT TEST_ARRAY('{xxx,yyyy,pppp,wwwwww}');

where TEST_ARRAY is my function name.

the records get inserted correctly. But now the problem is how to pass
the values from java to this function?

I have implemented the java.sql.Array interface, and given the actual
implementation to getArray() method, like this:

public Object getArray(){
    ArrayList temp = new ArrayList();
    temp.add("MMMM");
    temp.add("NNNN");
    temp.add("TTTTT");
    temp.add("QQQQQ");
    return temp.toArray();
  }
After this i am passing   this.getArray() values to database.

but at this point of time i get the following Exception:
org.postgresql.util.PSQLException: Unsupported Types value: 2,003
	at
org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1630)
	at
org.postgresql.jdbc3.AbstractJdbc3Statement.setObject(AbstractJdbc3Statement.java:1436)
	at
org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1636)

Is this the problem with the driver wht i am usng?


Can anyonme please help me to overcome this??


Waiting for your response,




view thread (2+ messages)  latest in thread

Message-ID: <1139911880.531826.81080@f14g2000cwb.googlegroups.com>
Permalink:  ../1139911880.531826.81080@f14g2000cwb.googlegroups.com/
Also on:    postgresql.org/message-id/1139911880.531826.81080@f14g2000cwb.googlegroups.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: kirank174@gmail.com
  Subject: Re: passing array(java) to postgre sql function
  In-Reply-To: <1139911880.531826.81080@f14g2000cwb.googlegroups.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox