需要帮助IBatis?

时间:2009-11-14 07:51:51

标签: ibatis.net

我正在使用IBatis作为我的应用程序。我正在使用IBatis 1.6.1版本。我认为它可以处理与数据库连接相关的所有操作。但我现在对此一点关注。有时我会将以下错误详细信息提供给我的日志文件

信息 无法打开与“MySQL,MySQL提供程序5.0.8.1”的连接。 资源 IBatisNet.DataMapper 堆 IBatisNet.DataMapper.DataedPart.DpenConnection()at IBatisNet.DataMapper.SqlMapSession.OpenConnection()at IBatisNet.DataMapper.Commands.DbCommandDecorator.System.Data.IDbCommand.ExecuteReader()at IBatisNet.DataMapper.MappedStatements.MappedStatement.RunQueryForObject at IBatisNet.DataMapper.SqlMapSession.OpenConnection(String connectionString) (RequestScope请求,ISqlMapSession会话,Object parameterObject,Object resultObject)IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObject(ISqlMapSession session,Object parameterObject,Object resultObject)at IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObject(ISqlMapSession session,Object parameterObject)位于EduVisionBasePage.GetSchoolUrl的D:\ SVN \ Sprint104 \ Persistence \ SchoolRepository.cs中的Sunya.VideoStreaming.Persistence.SchoolRepository.GetSchoolDetailsByUrl(String SchoolUrl)中的IBatisNet.DataMapper.SqlMapper.QueryForObject(String statementName,Object parameterObject) ASP.global_asax.Application_的School& _school) System.Web.HttpApplication.ExecuteStep上的System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()的BeginRequest(Object sender,EventArgs e)(IExecutionStep step,Boolean& completedSynchronously) 信息 太多联系 资源 MySql.Data 堆 at MySql.Data.MySqlClient.MySqlStream.OpenPacket()at MySql.Data.MySqlClient.NativeDriver.Authenticate411()at MySql.Data.MySqlClient.NativeDriver.Authenticate()at MySql.Data.MySqlClient.NativeDriver.Open()at MySql位于IBatisNet.DataMapper.SqlMapSession.OpenConnection(String connectionString)的MySql.Data.MySqlClient.MySqlConnection.Open()的MySql.Data.MySqlClient.MySqlPool.GetConnection()的.Data.MySqlClient.MySqlPool.GetPooledConnection()

有人对错误有所了解吗?

2 个答案:

答案 0 :(得分:0)

iBATIS已经存在了很长一段时间(2001),我怀疑MySQL提供程序中存在一个主要错误。你提到错误发生在“有时” - 如果它是间歇性的,也许问题出在其他地方。 “无法打开连接”可能意味着这一点。网络错误,数据库中断,太多未发布的连接,身份验证问题等都可能导致此错误。

答案 1 :(得分:0)

如果您正在使用JDBC事务管理器,请将myBatisConfig.xml中的数据源设置为“UNPOOLED”

<transactionManager type="JDBC"/> <dataSource type="UNPOOLED"> . . . </dataSource> </environment>

这是简短的回答。我的预感是连接池类持有太长时间的连接。降低“poolMaximunActiveConnection”和“poolMaximunIdleConnections”的值可以解决问题。

注意:使用myBatis 3.0.3 Java,mySql Windows 5.5.9

搜索词:iBatis,myBatis,“连接太多”,mySQL