vertica with spring jdbc template

时间:2016-02-20 15:09:49

标签: spring-jdbc vertica

我无法使用spring(4.2.x)将数据源配置为vertica(6.1.3)。

得到这个错误..关于我缺少什么的想法? RefMetricMappingDao扩展了NamedParameterJdbcDaoSupport。

<bean id="dataSource2" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="${vertica.driver.classname}"/>
    <property name="url" value="${vertica.connection.string}"/>
    <property name="username" value="${vertica.connection.username}"/>
    <property name="password" value="${vertica.connection.password}"/>
</bean>


<bean name="refMetricMappingDao" class="RefMetricMappingDao">
    <property name="dataSource" ref="dataSource2"/>
</bean>
  

java.lang.AbstractMethodError:com.vertica.jdbc.VerticaConnectionImpl.isValid(I)Z       在org.apache.commons.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:918)       在org.apache.commons.dbcp2.PoolableConnection.validate(PoolableConnection.java:283)       在org.apache.commons.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:357)       在org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2307)       在org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2290)       在org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2039)       在org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1533)       在org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)       在org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)       在org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:615)       在org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:680)       在org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:707)       在org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:757)       在org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:192)       在org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForList(NamedParameterJdbcTemplate.java:250)       在org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForList(NamedParameterJdbcTemplate.java:257)       在

1 个答案:

答案 0 :(得分:0)

duh ... vertica附带了一个数据源类

<bean id="dataSource2" class="com.vertica.jdbc.DataSource">
    <property name="URL" value="${vertica.connection.string}"/>
    <property name="userID" value="${vertica.connection.username}"/>
    <property name="password" value="${vertica.connection.password}"/>
    <property name="searchPath" value="${vertica.connection.schemaname}"/>
    <property name="batchInsertDirect" value="true"/>
</bean>