How to Configure SSL over Database in Spring?

Posted by Sameer Malhotra on Stack Overflow See other posts from Stack Overflow or by Sameer Malhotra
Published on 2010-04-24T20:50:11Z Indexed on 2010/04/24 20:53 UTC
Read the original article Hit count: 397

Filed under:
|
|
|

Hi,

I want to add SSL security in the Database layer. I am using Struts2.1.6, Spring 2.5, JBOSS 5.0 and Informix 11.5. Any idea how to do this?

I have researched through a lot on the internet but could not find any solution.

Please suggest!

Here is my datasource and entity manager beans which is working perfect without SSL:

<bean id="entityManagerFactory"  
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">  
    <property name="dataSource" ref="dataSource" />  
    <property name="jpaVendorAdapter">  
        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">  
            <property name="database" value="INFORMIX" />  
            <property name="showSql" value="true" />  

        </bean>  
    </property>  
</bean>  

<bean id="dataSource"  
    class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">  
    <property name="driverClassName" value="com.informix.jdbc.IfxDriver" />  
    <property name="url"  
        value="jdbc:informix-sqli://SERVER_NAME:9088/DB_NAME:INFORMIXSERVER=SERVER_NAME;DELIMIDENT=y;" />  
    <property name="username" value="username" />  
    <property name="password" value="password" />  
    <property name="minIdle" value="2" />  
</bean>  

<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" lazy-init="false">  
    <property name="targetObject" ref="dataSource" />  
    <property name="targetMethod" value="addConnectionProperty" />  
    <property name="arguments">  
    <list>  
    <value>characterEncoding</value>  
    <value>UTF-8</value>  
    </list>  
    </property>  
</bean>  

<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" scope="prototype">  
    <property name="dataSource" ref="dataSource" />  
</bean>  


<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">  
    <property name="entityManagerFactory" ref="entityManagerFactory" />  
</bean>  

<tx:annotation-driven transaction-manager="transactionManager" /> 

© Stack Overflow or respective owner

Related posts about spring

Related posts about ssl