Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassCastException: com.sun.proxy.$Proxy37 cannot be cast to com.vertica.jdbc.VerticaConnection #50

Open
Jpaagt opened this issue Apr 21, 2017 · 1 comment

Comments

@Jpaagt
Copy link

Jpaagt commented Apr 21, 2017

Version: VerticaBulkLoader-6.1.0.7-258.jar

Stack trace:
java.lang.ClassCastException: com.sun.proxy.$Proxy37 cannot be cast to com.vertica.jdbc.VerticaConnection at org.pentaho.di.verticabulkload.VerticaBulkLoader$1.run(VerticaBulkLoader.java:262)

This occurs when retrieving connections from a ConnectionPool such as the Tomcat JDBC Connection Pool which wraps the JDBC Connection instance:

Connection pools create wrappers around the actual connection in order to properly pool them. We also create interceptors in these wrappers to be able to perform certain functions. If there is a need to retrieve the actual connection, one can do so using the javax.sql.PooledConnection interface.

See: The Tomcat JDBC Connection Pool: Getting the actual JDBC connection

The VerticaBulkLoader class could check to see if the connection is wrapped and if so the following can be used to obtain the wrapped connection:

Connection con = datasource.getConnection(); Connection actual = ((javax.sql.PooledConnection)con).getConnection();

This would allow to use JNDI and the usage of JDBC connection pools to manage Vertica JDBC connections.

VerticaCopyStream stream = new VerticaCopyStream( (VerticaConnection) ( data.db.getConnection() ), dml );

See: VerticaBulkLoader.java#L262

@Jpaagt
Copy link
Author

Jpaagt commented Apr 21, 2017

Created pull request proposing solution for the issue 6.1.0.7 r issue 50 #51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant