ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hilde.DE-GRA...@ext.cec.eu.int
Subject Connection reset Oracle error
Date Tue, 14 Mar 2006 08:20:33 GMT
Hello,

I'm using Ibatis with Spring and everything works ok. The problem I have for
the moment is that in our production server when they stop and restarts
Oracle for backup proposes then my application loses the connection and is
not able anymore to use the connection, we then need to reload it to work
again. Here is an example of a DAO bean in the applicationContex file :

<bean id="dataSource" class="db.DataSourceApplication" init-method="init"
destroy-method="close">
		<property name="jdbcConnectionProperties"><ref
bean="SqlMapClientProperties10"/>
		</property>
	</bean>
	
	<bean id="sqlMapClient10"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
		<property name="configLocation">
			<value>classpath:SqlMapConfig.xml</value>
		</property>
	</bean>

	<bean id="countryDao" class="daoImpl.SqlMapClientCountry">
		<property name="dataSource"><ref
local="dataSource"/></property>
		<property name="sqlMapClient"><ref
local="sqlMapClient10"/></property>
	</bean>

The SqlMapConfig file only contains the following :

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
    PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
    "http://www.ibatis.com/dtd/sql-map-config-2.dtd
<http://www.ibatis.com/dtd/sql-map-config-2.dtd> ">

<sqlMapConfig>

<settings
    cacheModelsEnabled="false"
    enhancementEnabled="true"
    lazyLoadingEnabled="true"
    errorTracingEnabled="true"
    maxRequests="250"
    maxSessions="150"
    maxTransactions="30"
    useStatementNamespaces="false"
    />

	<sqlMap resource="Ibatis/maps/Country.xml"/>

</sqlMapConfig>

My DataSourceApplication class contains the database connection details and
extends the BasicDataSource:

public class DataSourceApplication extends BasicDataSource {

	private ConfigEngineAppToProperties jdbcConnectionProperties;

	final public void setJdbcConnectionProperties(
			ConfigEngineAppToProperties props) {
		jdbcConnectionProperties = props;

	}

	final public void init() throws RemoteException,SQLException {

		String driver = (String)
jdbcConnectionProperties.get("driver");
		String url = (String) jdbcConnectionProperties.get("url");
		String username = (String)
jdbcConnectionProperties.get("username");
		String password = (String)
jdbcConnectionProperties.get("password");
		
		
			super.setDriverClassName(driver);
			super.setUrl(url);
			super.setUsername(username);
			super.setPassword(password);
		
	}

		
}

Does anyone know how I can catch this problem and prevent the stop/start of
Oracle of stopping my application. I would like that my application can
catch this error and waits until Oracle is up again.The error I get is the
following :

 WARN [org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator]
- <Unable to translate SQLException with errorCode '17002', will now try the
fallback translator>
 ERROR [org.springframework.jdbc.datasource.DataSourceUtils] - <Could not
close JDBC connection>
java.sql.SQLException: Already closed.

After that every quey called has the following error :

 Cause: java.sql.SQLException: Io exception: Connection reset>

The only way to have it working again is by reloading the application in
Tomcat 5.


Thank you,

Hilde

Mime
View raw message