问题描述
框架用的SpringMVC+Hibernate4,现在用了两个数据库,都是Oracle数据库,用的的dblink的方式实现的不同的数据库的表可以互相联查。在A数据库中建B数据库的表的link。但是最近总出现一些问题,程序运行一段时间后,自己连不上数据库了,WebLogic服务也没停,但是重启WebLogic后就一切正常。过段时间后又会出现连不上数据库的问题。下面是后台出错日志。所以就想换一种方式连接数据库。要求就是A数据库和B数据库的表可以互相联查,不是网上说的那种一会儿切换到A库,一会儿切换到B库。不知道用什么方式,希望有这方面的经验的大神能提供点建议。下面是后台报错信息,在网上也搜索了,很多人都没解决这错误,我也准备放弃了。WARN:org.hibernate.engine.jdbc.spi.SqlExceptionHelper-SQLError:17410,SQLState:08000ERROR:org.hibernate.engine.jdbc.spi.SqlExceptionHelper-无法从套接字读取更多的数据DEBUG:com.hshunion.pews.model.dao.BaseHibernateDAO-executesqlerror....org.hibernate.exception.JDBCConnectionException:无法从套接字读取更多的数据atorg.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:131)atorg.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)atorg.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)atorg.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)atorg.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129)atorg.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)at$Proxy76.executeQuery(UnknownSource)atorg.hibernate.loader.Loader.getResultSet(Loader.java:1962)atorg.hibernate.loader.Loader.doQuery(Loader.java:829)atorg.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289)atorg.hibernate.loader.Loader.doList(Loader.java:2447)atorg.hibernate.loader.Loader.doList(Loader.java:2433)atorg.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2263)atorg.hibernate.loader.Loader.list(Loader.java:2258)atorg.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:331)atorg.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1697)atorg.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:225)atorg.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:156)atcom.hshunion.pews.model.dao.BaseHibernateDAO.getListBysql(BaseHibernateDAO.java:116)atcom.hshunion.pews.service.CdorgainService.getOrginfoList(CdorgainService.java:35)atcom.hshunion.pews.service.CdorgainService$$FastClassByCGLIB$$3825368b.invoke(<generated>)atnet.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)atorg.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689)atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)atorg.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)atorg.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)atorg.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)atcom.hshunion.pews.service.CdorgainService$$EnhancerByCGLIB$$77d80d97.getOrginfoList(<generated>)atcom.hshunion.pews.web.controller.CdorgainColltroller.getTheMain(CdorgainColltroller.java:52)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:616)atorg.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)atorg.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)atorg.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)atorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)atorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)atorg.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)atorg.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)atorg.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)atorg.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)atorg.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:707)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:820)atweblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)atweblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)atweblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)atweblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)atweblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)atorg.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)atweblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)atweblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)atweblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)atweblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)atweblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)atweblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)atweblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)atweblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)atweblogic.work.ExecuteThread.execute(ExecuteThread.java:201)atweblogic.work.ExecuteThread.run(ExecuteThread.java:173)Causedby:java.sql.SQLRecoverableException:无法从套接字读取更多的数据atoracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:101)atoracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)atoracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)atoracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)atoracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271)atoracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445)atoracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1059)atoracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1016)atoracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:589)atoracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)atoracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)atoracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)atoracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1188)atoracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3386)atoracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3430)atoracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)atweblogic.jdbc.wrapper.PreparedStatement.executeQuery(PreparedStatement.java:135)atsun.reflect.GeneratedMethodAccessor180.invoke(UnknownSource)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:616)atorg.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122)...59more
解决方案
解决方案二:
是不是驱动包的问题,要不换个驱动包试试
解决方案三:
是不是连接池的问题,修改配置试试
解决方案四:
应该是连接池配置问题访问的过多达到上限连接池没有设置自动重新请求连接