Reputation: 1
I am working on the application that works with an Informix database using Spring and it is running on Tomcat. The configuration of the data source is done within the application as following:
/MyApp/META-INF/context.xml
<Context path="/MyApp"
reloadable="false"
cachingAllowed="false" >
<Resource name="jdbc/MyAppDS"
auth="Container" type="javax.sql.DataSource"
driverClassName="com.informix.jdbc.IfxDriver"
url="jdbc:informix-sqli://app.prod.com:22222/prod:informixserver=prodshm;IFX_LOCK_MODE_WAIT=20;IFX_XASPEC=Y;"
username="user" password="password"
maxActive="100" maxIdle="25" maxWait="10000"
removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"/>
</Context>
/MyApp/WEB-INF/web.xml
…
<resource-ref>
<res-ref-name>jdbc/MyAppDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/config/applicationContext.xml
/WEB-INF/config/dataAccessContext.xml
</param-value>
</context-param>
…
/MyApp/config/dataAccessContext.xml
<beans>
<import resource="dataSource-def.xml"/>
<bean id="scriptDao" parent="txProxyTemplate">
<property name="target">
<bean class="com.myapp.script.ScriptDaoJdbc">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>
</property>
</bean>
…
</beans>
/MyApp/config/dataSource-def.xml
<beans>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"><value>java:/comp/env/jdbc/MyAppDS</value></property>
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>
</beans>
It seems that the parameter IFX_LOCK_MODE_WAIT from context.xml does not work since I have a lot of lock errors, such as:
error code [-244]; Could not do a physical-order read to fetch next row.; ISAM error: record is locked.
error code [-245]; Could not position within a file via an index.; ISAM error: key value locked
In order to check if my assumption is correct I started to send "SET LOCK MODE TO WAIT 20" explicitly before every problematic query and can see that it worked - there are no error messages anymore.
The previous configuration of context.xml is listed below and didn't work either:
/MyApp/META-INF/context.xml (previous version)
<Context path="/MyApp"
reloadable="false"
cachingAllowed="false" >
<Resource name="jdbc/MyAppDS"
auth="Container" type="javax.sql.DataSource"
driverClassName="com.informix.jdbc.IfxDriver"
url="jdbc:informix-sqli://app.prod.com:22222/prod:informixserver=prodshm"
username="user" password="password"
maxActive="100" maxIdle="25" maxWait="10000"
removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
connectionProperties="ifxIFX_LOCK_MODE_WAIT=20;ifxIFX_XASPEC=Y;" />
</Context>
Why might the statement IFX_LOCK_MODE_WAIT=20
in the context.xml not work?
And what would be a better way to accomplish this?
Thank you!
Upvotes: 0
Views: 713
Reputation:
If you can, try changing the isolation level ;IFX_ISOLATION_LEVEL=1
to see if you have differences.
Maybe define your informix ressource in a property file instead of a xml context
Upvotes: 0