#120 NewProxyConnection.createArrayOf throws AbstractMethodError

v1.0 (example)
closed-fixed
nobody
None
5
2015-02-04
2013-08-22
Eric
No

createArrayOf throws

java.lang.AbstractMethodError: com.mchange.v2.c3p0.impl.NewProxyConnection.createArrayOf(Ljava/lang/String;[Ljava/lang/Object;)Ljava/sql/Array;

When called on a pooled connection. The datasource is obtained with:

    DataSource unpooledDataSource = DataSources.unpooledDataSource();
    DataSource pooledDataSource = DataSources.pooledDataSource(unpooledDataSource);

If the unpooledDataSource (Postgres JDBC 9.2-1003-jdbc4) is used, the error doesn't happen.

I can work around it with this method:

private Array getSqlArray(Object[] data, String sqlTypeName, Connection conn) throws SQLException {
    Array array;
    if (conn instanceof C3P0ProxyConnection) {
        C3P0ProxyConnection proxy = (C3P0ProxyConnection) conn;
        try {
            Method m = Connection.class.getMethod("createArrayOf", String.class, Object[].class);
            Object[] args = { sqlTypeName, data };
            array = (Array) proxy.rawConnectionOperation(m, C3P0ProxyConnection.RAW_CONNECTION, args);
        } catch (SecurityException | ReflectiveOperationException | IllegalArgumentException e) {
            log.error("error calling createArrayOf", e);
            throw new SQLException(e);
        }
    } else {
        array = conn.createArrayOf("int4", data);
    }
    return array;
}

Is this expected or known? This method has been around since 1.6.

Related

Bugs: #120

Discussion

  • Eric

    Eric - 2013-08-22

    Sorry, I forget the c3p0 version. I'm using 0.9.2.1.

     
  • Eric

    Eric - 2013-08-22

    This appears to be fixed in 0.9.5-pre3. Is this a JDBC4 feature?

     
  • Steve Waldman

    Steve Waldman - 2013-08-22

    you've got it! Statement.createArrayOf is a JDBC4 method. it's supported as of c3p0-0.9.5

    smiles,
        steve
    

    On Aug 22, 2013, at 11:28 AM, Eric wrote:

    This appears to be fixed in 0.9.5-pre3. Is this a JDBC4 feature?

    [bugs:#120] NewProxyConnection.createArrayOf throws AbstractMethodError

    Status: open
    Created: Thu Aug 22, 2013 06:04 PM UTC by Eric
    Last Updated: Thu Aug 22, 2013 06:10 PM UTC
    Owner: nobody

    createArrayOf throws

    java.lang.AbstractMethodError: com.mchange.v2.c3p0.impl.NewProxyConnection.createArrayOf(Ljava/lang/String;[Ljava/lang/Object;)Ljava/sql/Array;
    When called on a pooled connection. The datasource is obtained with:

    DataSource unpooledDataSource = DataSources.unpooledDataSource();
    

    DataSource pooledDataSource = DataSources.pooledDataSource(unpooledDataSource);
    If the unpooledDataSource (Postgres JDBC 9.2-1003-jdbc4) is used, the error doesn't happen.

    I can work around it with this method:

    private Array getSqlArray(Object[] data, String sqlTypeName, Connection conn) throws SQLException {

    Array array;

    if (conn instanceof C3P0ProxyConnection) {

    C3P0ProxyConnection proxy = (C3P0ProxyConnection) conn;

    try {

    Method m = Connection.class.getMethod("createArrayOf", String.class, Object[].class);

    Object[] args = { sqlTypeName, data };

    array = (Array) proxy.rawConnectionOperation(m, C3P0ProxyConnection.RAW_CONNECTION, args);

    } catch (SecurityException | ReflectiveOperationException | IllegalArgumentException e) {

    log.error("error calling createArrayOf", e);

    throw new SQLException(e);

    }

    } else {

    array = conn.createArrayOf("int4", data);

    }

    return array;
    }
    Is this expected or known? This method has been around since 1.6.

    Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/c3p0/bugs/120/

    To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

     

    Related

    Bugs: #120

  • Eric

    Eric - 2013-08-22

    Thanks. Sorry for opening this up before I did all the research.

     
  • Steve Waldman

    Steve Waldman - 2013-12-04
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks