I want to connect my Spring JDBC application with SSL. The DBMS is Informix IBM.
I'm using a spring-config.xml file in which I declare the datasource bean:
<bean id="dataSource" class="com.sopra.datasource.CDataSource" init-method="init"
destroy-method="close">
<property name="url" value="${jdbc.url}" />
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="removeAbandoned" value="true" />
<property name="initialSize" value="20" />
<property name="maxActive" value="30" />
</bean>
Many thanks.
Mac
Have you got a basic SSL connection to the Informix server working, for example using the dbaccess tool? If not you might want to refer to this developerWorks article for the configuration steps:
This article uses Informix 11.50 whereas I was using 12.10 which uses a later version of the IBM GSKit so I substituted the gsk8capicmd_64 command everywhere where the article uses gsk7capicmd.
I have no knowledge of Spring JDBC so I then used a basic JDBC demo program to test the SSL connection. This program was based on the "JDBC sample for SSL connection" program listed in the Informix JDBC Driver Guide:
https://www.ibm.com/support/knowledgecenter/en/SSGU8G_12.1.0/com.ibm.jdbc_pg.doc/ids_jdbc_490.htm
Here are some relevant extracts from the code:
System.setProperty("javax.net.ssl.trustStore", "/home/keystore/keystore");
System.setProperty("javax.net.ssl.trustStorePassword", "password");
IfxConnectionPoolDataSource cds = new IfxConnectionPoolDataSource();
cds.setIfxIFXHOST("informix_hostname"");
cds.setServerName("informix_server");
cds.setPortNumber(port_number);
cds.setIfxSSLCONNECTION("true");
cds.setUser("informix");
cds.setPassword("password");
cds.setDatabaseName("stores_demo");
conn = cds.getPooledConnection().getConnection();
You may also need to configure a Java Cryptography Extension-complian encryption services provider as described in the Encryption Options section of the Informix JDBC Driver Guide:
https://www.ibm.com/support/knowledgecenter/en/SSGU8G_12.1.0/com.ibm.jdbc_pg.doc/ids_jdbc_059.htm