Spring数据源: - 您的网络访问被中断

时间:2014-08-23 17:22:56

标签: java spring ms-access spring-mvc jdbc-odbc

我已经创建了一个用于读取ms访问大型数据库文件的Spring Web应用程序。有时这个文件由于大尺寸而被修复。在压缩数据库文件之前,将关闭所有打开的会话。当我们从spring web应用程序连接到数据库关闭会话和修复数据库后,我得到以下错误。

 HTTP Status 500 - Request processing failed; nested exception is 
 org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; 
 SQL [select [DateTimeEntered],[GoodWeight],[MachineSpeed],[GradeCode],[RejectedWeight] 
 from [tblMachineProduction] where [DateTimeEntered] between ? and ? order by 
 [DateTimeEntered]]; [Microsoft][ODBC Microsoft Access Driver] Your network access was 
 interrupted. To continue, close the database, and then open it again.; nested exception 
 is java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Your network access 
 was interrupted. To continue, close the database, and then open it again.

如何处理此异常或如何重新加载/初始化数据源。

Spring代码在这里: -

<bean id="dataSource" scope="prototype" class="org.apache.commons.dbcp.BasicDataSource"
    destroy-method="close">
    <property name="driverClassName" value="${jdbc.driverClassName}" />
    <property name="url" value="${jdbc.database.url}" />
    <property name="username" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />

    <property name="testOnBorrow" value="true"/>
    <property name="testOnReturn" value="true"/>
    <property name="testWhileIdle" value="true"/>

</bean>

0 个答案:

没有答案