pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Allan Kamau <kamauallan@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Error when attempting to call Connection.createArrayOf() method
Date: Wed, 16 Dec 2009 12:47:15 +0300
Message-ID: <ab1ea6540912160147p6414cf28i789750635fa266b0@mail.gmail.com> (raw)

I am trying create an array of text to pass to a postgreSQL function
and I am getting the following error
"java.lang.AbstractMethodError:
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.createArrayOf(Ljava/lang/String;[Ljava/lang/Object;)Ljava/sql/Array;"

I have tried googling for a possible solution without much success the
closed I got was the discussion in this thread
"http://archives.postgresql.org/pgsql-jdbc/2009-04/msg00013.php"; but I
am unable to find the successful conclusion/solution for this error.

I am using JDBC driver (postgresql-8.4-701.jdbc4.jar) for postgreSQL
and commons-dbcp-1.2.2.jar for connection pooling.

My code like like this.


       public static int persistUserInput(
               Connection conn,String
_user_input_id,Map<String,Vector<String>> userInputMap
       )throws SQLException
       {
               int _rows_affected=-1;
               String _input_name=null;
               String _input_values[]=new String[0];
               PreparedStatement ps=null;ResultSet rs=null;
               for (Map.Entry<String,Vector<String>> y :
userInputMap.entrySet())
               {
                       _input_name=y.getKey();
                       Vector<String> v=y.getValue();
                       _input_values=v.toArray(_input_values);
                       try
                       {

                               String _sql_query=""
                                       +" SELECT persist_user_input(?,?,?);"
                               ;
                               ps=conn.prepareStatement(_sql_query);
                               ps.setString(1,_user_input_id);
                               ps.setString(2,_input_name);

ps.setArray(3,conn.createArrayOf("text",_input_values));
                               rs=ps.executeQuery();
                               if(rs.next())
                               {
                                       _rows_affected=rs.getInt(1);
                               }
                               rs.close();
                               ps.close();
                       }
                       catch(SQLException e)
                       {
                               throw e;
                       }
                       finally
                       {
                               /*
                               rs.close();
                               ps.close();
                               if(rs!=null&&!rs.isClosed())
                               {
                                       rs.close();
                               }
                               rs=null;
                               if(ps!=null&&!ps.isClosed())
                               {
                                       ps.close();
                               }
                               ps=null;
                               */
                       }
               }
               return _rows_affected;
       }



view thread (6+ messages)  latest in thread

Message-ID: <ab1ea6540912160147p6414cf28i789750635fa266b0@mail.gmail.com>
Permalink:  ../ab1ea6540912160147p6414cf28i789750635fa266b0@mail.gmail.com/
Also on:    postgresql.org/message-id/ab1ea6540912160147p6414cf28i789750635fa266b0@mail.gmail.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: kamauallan@gmail.com
  Subject: Re: Error when attempting to call Connection.createArrayOf() method
  In-Reply-To: <ab1ea6540912160147p6414cf28i789750635fa266b0@mail.gmail.com>
  References: <ab1ea6540912160147p6414cf28i789750635fa266b0@mail.gmail.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