Cannot create JDBC driver of class ‘com.mysql.jdbc.Driver’ for connect URL ‘jdbc:postgresql://localhost:5432/my_test’

This turned out to be a mistake in the config.  I was using mysql driver. It was a copy-paste mistake.

<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>

 

Here is the correct config:

<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<value>org.postgresql.Driver</value>
</property>

 

And the postgres entry in pom.xml :

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.23</version>
</dependency>

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.