Search code examples
springdb2weblogicdatasourcehikaricp

Migrating from Weblogic to Spring/HikariCP


My current system is as follows:

  • Weblogic 12c
  • Spring 3.x
  • JSF 1.1

We are looking to migrate from Weblogic to HikariCP as we start our transition to Spring Boot & Angular.

Our datasources were setup and maintained in Weblogic and configured in Spring via the JndiObjectFactoryBean.

We'd like to lift our weblogic datasource/connection pool and replace it with Spring/Hikari.

I've changed all of the dataSources to Spring JDBC Beans.

Without changing my code is there a way to setup Hikari with these Datasource changes?

<bean id = "dataSource"
            class = 
  "org.springframework.jdbc.datasource.DriverManagerDataSource">
   <property name = "driverClassName" value = 
      "com.ibm.as400.access.AS400JDBCDriver"/>
   <property name = "url" value = "jdbc:as400://test"/>
   <property name = "username" value = "xxxxx"/>
   <property name = "password" value = "xxxxx"/>
</bean>

Solution

  • The configuration in context file will be :

     <bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
                <property name="dataSourceClassName" value="org.springframework.jdbc.datasource.DriverManagerDataSource" />
                <property name="minimumIdle" value="1"/>
                <property name="maximumPoolSize" value="10"/>
                <property name="connectionTimeout" value="5000"/>
                <property name="dataSourceProperties">
                    <props>
                        <prop key="url">jdbc:as400://test</prop>
                        <prop key="user">xxxxx</prop>
                        <prop key="password">xxxxx</prop>
                    </props>
                </property>
     </bean>
    

    Hope this helps you :)