Hello,
I have an application running under JBoss.
Up to today, I was using Postgres 7.3 and the appropriate version of the
jdbc driver.
In my application, I have to call a user-defined function which accept
in parameters 2 arrays. Here is the header of my function :
CREATE OR REPLACE FUNCTION getmembers(int8, int8, _text,
_float8)
So I called it using a prepared statement with setArray() :
double[] weights = {0.5};
String[] names = {"foo1", "foo2"};
java.sql.Array a_names = PostgresArray.create(names);
java.sql.Array a_weights = PostgresArray.create(weights);
ps = conn.prepareStatement("SELECT * FROM
getmembers(?,?,?::_text,?::_float8);");
ps.setLong(1, 1);
ps.setLong(2, 2);
ps.setArray(3, a_names);
ps.setArray(4, a_weights);
ps.executeQuery();
PostgresArray is a class which I found on the archives.postgresql.org.
The code is given is attached.
All worked fine.
But today, I decided to upgrade to Postgres 8.0 beta 3.
No problem with the definition of my function.
I downloaded the appropriate JDBC driver : pgdev.306.jdbc3.jar.
Now running the same code as before, I get the error while executing the
query :
java.sql.SQLException: ERROR: cannot cast type text to
text[]
So, what am I doing wrong?
Is it a beta bug or is my code incorrect?
What is the correct way to use SetArray()?
Thanks
JR