关于数据库连接,我使用连接池和Firebird数据库。我使用的是FirebirdSql.Data.FirebirdClient版本2.6.5.0。我的连接字符串如下:
<add name="db" connectionString="Server=***;user
id=***;password=***;Charset=ANSI_CHARSET;Database=***;
Connection lifetime=15;Pooling=true;MinPoolSize=0;MaxPoolSize=10"
providerName="FirebirdSql.Data.FirebirdClient" />
我有以下使用数据库连接的代码:
```
我有以下使用数据库连接的代码:
```IEnumerable<Orders> ord = new List<Orders>();
using(FbConnection fbCon = new FbConnection("my connection string"))
{
fbCon.Open();
using(FbCommand command = fbCon.CreateCommand())
{
command.CommandText = "SELECT first 100 ID, SYMBOL, NUMBER, POS FROM Z1";
Debug.WriteLine(string.Format("Before Close: {0}", FirebirdSql.Data.FirebirdClient.FbConnection.GetPooledConnectionCount(fbCon)));
ord= command.ExecuteReader(CommandBehavior.CloseConnection).ConvertToList<Orders>();
}
}
然而,我遇到了错误:
Timeout exceeded.
at FirebirdSql.Data.FirebirdClient.FbConnectionPool.CheckMaxPoolSize ()
at FirebirdSql.Data.FirebirdClient.FbConnectionPool.CheckOut ()
at FirebirdSql.Data.FirebirdClient.FbConnection.Open ()
当我调用上述代码时,由于达到了MaxPoolSize而导致错误...在输出窗口中,我会看到附加信息:
Before Close: 1
Before Close: 2
...
Before Close: 10
zam
变量未定义。 - cincura.net