commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruno P. Kinoshita (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DBCP-471) Cannot use connectionInitSqls property in BasicDataSource
Date Thu, 27 Oct 2016 00:54:58 GMT

    [ https://issues.apache.org/jira/browse/DBCP-471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15610216#comment-15610216
] 

Bruno P. Kinoshita commented on DBCP-471:
-----------------------------------------

Perhaps you could wrap the datasource object, and in the wrapper object you would return List<String>
and set with List<String> too. Or use an older version of commons-dbcp if that works;
though I would suggest the former option, if you really can't upgrade Spring.

But note too, that there are security fixes at 3.2.15. 3.2.9 and other releases after 3.2.4.
Even if that fixes your problem, your application would still be vulnerable to other issues
:-)

> Cannot use connectionInitSqls property in BasicDataSource
> ---------------------------------------------------------
>
>                 Key: DBCP-471
>                 URL: https://issues.apache.org/jira/browse/DBCP-471
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 2.1.1
>            Reporter: happybuddha
>
> Error : 
> {code}Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property
'connectionInitSqls' of bean class [org.apache.commons.dbcp2.BasicDataSource]: Bean property
'connectionInitSqls' is not writable or has an invalid setter method. Does the parameter type
of the setter match the return type of the getter?
> 	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1042)
> 	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:902)
> 	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)
> {code}
> Configuration : 
> {code}
>   <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
>     <property name="driverClassName" value="${database.driverClassName}" />
>     <property name="url" value="${database.url}" />
>     <property name="username" value="${database.username}" />
>     <property name="password" value="${database.password}" />
>     <property name="connectionInitSqls">
>     <list>
>     	<value>Select 1 from dual;</value>
>     </list>
>     </property>
>   </bean>
> {code}
> Similar issue for another bean : https://issues.apache.org/jira/browse/DBCP-469
> The property is listed as a List<String>, has a getter which returns a List<String>
but has a setter which takes a Collection<String> 
> This is also not in line with what was in versions before 2 (dbcp.BasicDataSource)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message