Reputation: 97
I have a Spring MVC project that I am using NamedParameterJdbcTemplate
to connect to a postgres database
.
When I try to launch my application, I get an exception:
Cannot convert value of type
[org.springframework.jdbc.datasource.DriverManagerDataSource]
to required type [sun.jdbc.odbc.ee.DataSource] for
property 'dataSource': no matching editors or conversion strategy found
My dataSource
bean looks like this:
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://localhost:5432/********" />
<property name="username" value="postgres" />
<property name="password" value="********" />
</bean>
I have connected to postgres with NamedParameterJdbcTemplate
before. Am I missing a dependency that makes this conversion possible, or what is the problem?
Upvotes: 0
Views: 1393
Reputation: 8946
As the exception itsel reveals that it is expecting sun.jdbc.odbc.ee.DataSource
and found org.springframework.jdbc.datasource.DriverManagerDataSource
That implies you have wrong import wherever you are using DataSource
class make sure it is imported from javax.sql.DataSource
Upvotes: 3