Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java SQL Server 2008 Hibernate 4.1中的频繁读取超时_Java_Sql_Sql Server_Hibernate_Amazon Web Services - Fatal编程技术网

Java SQL Server 2008 Hibernate 4.1中的频繁读取超时

Java SQL Server 2008 Hibernate 4.1中的频繁读取超时,java,sql,sql-server,hibernate,amazon-web-services,Java,Sql,Sql Server,Hibernate,Amazon Web Services,sql server 2008r2和hibernate面临一个奇怪的问题。经常从数据库获取读取超时错误,以下是错误详细信息: 10:02:11,368 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/55.2.0.180:443-36) SQL Error: 0, SQLState: 08S01 10:02:11,368 ERROR [org.hibernate.engine.jdbc.spi.Sql

sql server 2008r2和hibernate面临一个奇怪的问题。经常从数据库获取读取超时错误,以下是错误详细信息:

    10:02:11,368 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/55.2.0.180:443-36) SQL Error: 0, SQLState: 08S01
    10:02:11,368 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/55.2.0.180:443-36) Read timed out
    10:02:11,368 ERROR [stderr] (http-/55.2.0.180:443-36) org.hibernate.exception.JDBCConnectionException: Read timed out10:02:11,368 ERROR [stderr] (http-/55.2.0.180:443-36)  at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:131)10:02:11,368 ERROR [stderr] (http-/55.2.0.180:443-36)    
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)10:02:11,368 ERROR [stderr] (http-/55.2.0.180:443-36)   
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)10:02:11,368 ERROR [stderr] (http-/55.2.0.180:443-36)   
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)10:02:11,384 ERROR [stderr] (http-/55.2.0.180:443-36)   
at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129)10:02:11,384 ERROR [stderr] (http-/55.2.0.180:443-36) 




... 131 more10:02:11,727 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/55.2.0.180:443-36) SQL Error: 0, SQLState: null
    10:02:11,727 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/55.2.0.180:443-36) The connection is closed.
    10:02:11,727 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/CastrolCubedUnit].[spring]] (http-/55.2.0.180:443-36) JBWEB000236: Servlet.service() for servlet spring threw exception: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
如果相关,则没有更多信息:

  • 我们正在使用带有hibernate的C3P0连接池。和配置 连接测试也是如此。我们已经(及时)检查了数据库 (发生异常的情况)exec sp_lock命令DB仅保留S或 是锁

  • 我们没有在本地环境中运行它 好的

  • 应用程序托管在AmazonAWS中,有两个应用程序服务器和 问题持续存在的一个负载平衡器


  • 非常感谢我们的帮助

    MS SQl server保留所有查询的统计信息。table
    sys.dm_exec_query_stats
    包含关于每个查询的统计信息,但在此之前,我建议您运行DBCC命令,该命令重新开始记录查询运行时间,并完成一些缓存清除工作

    DNDC命令
    DBCC FREEPROCCACHE

    下面是查找长查询的查询

    SELECT DISTINCT TOP 10
    t.TEXT QueryName,
    s.execution_count AS ExecutionCount,
    s.max_elapsed_time AS MaxElapsedTime,
    ISNULL(s.total_elapsed_time / s.execution_count, 0) AS AvgElapsedTime,
    s.creation_time AS LogCreatedOn,
    ISNULL(s.execution_count / DATEDIFF(s, s.creation_time, GETDATE()), 0) AS FrequencyPerSec
    FROM sys.dm_exec_query_stats s
    CROSS APPLY sys.dm_exec_sql_text( s.sql_handle ) t
    ORDER BY
    s.max_elapsed_time DESC
    GO 
    

    您可以对查询进行优化。

    对于每个查询,您都会收到此消息?您能够远程登录到DB服务器吗?不是每个查询,但一旦开始收到此错误,我们就会经常收到此消息。是的,telnet工作正常。c3p0设置文件中的超时设置是什么?还有,有没有什么问题需要花更多的时间来解决呢?我不这么认为。。这是我们的Hibrate设置和c3p0设置