1

このメソッドにより、エラー ファイルが次のエラーでいっぱいになります。

Connection Pool has reached the maximum number of connections

public static int IsValidPortalUser(string p_u, string p_p) {
            int item = 0;
            using (IfxConnection ifxConnection = new IfxConnection(DB_Connection.connectionString))
            {
                IfxCommand ifxCommand = new IfxCommand();
                string str = DB_Connection.My_Decryption_2(p_p);
                try
                {
                    if (ifxConnection.State == 0)
                    {
                        ifxConnection.Open();
                    }
                     DB_Connection.DBCmd = new IfxCommand();
                     DB_Connection.DBCmd.Connection = ifxConnection;
                     DB_Connection.DBCmd.CommandText = "SELECT nvl(emp_num,0) FROM htoemp WHERE username = ? AND DECRYPT_CHAR(password, '78dfdf') = ? ";
                     DB_Connection.DBCmd.Parameters.Add("user_name", p_u);
                     DB_Connection.DBCmd.Parameters.Add("password", str);

                    IfxDataReader ifxDataReaders = ifxCommand.ExecuteReader();
                    using (ifxDataReaders)
                    {
                        if (ifxDataReaders.Read())
                        {
                            item = (int)ifxDataReaders[0];
                        }
                        ifxDataReaders.Close();
                    }
                }
                catch (ApplicationException applicationException)
                {
                }
                ifxConnection.Close();
            }
            return item;
        }

   Error Message:Connection Pool has reached the maximum number of connections.  Stack Trace :    at IBM.Data.Informix.IfxConnectionPool.ReportOpenTimeOut()
   at IBM.Data.Informix.IfxConnectionPool.Open(IfxConnection connection)
   at IBM.Data.Informix.IfxConnPoolManager.Open(IfxConnection connection)
   at IBM.Data.Informix.IfxConnection.Open()
   at DB_Connection_s.DB_Connection.IsValidPortalUser(String p_u, String p_p)
   at LoginSystem.LoginPage_ar.ValidateUser(String UserName, String Password) in H:\LoginSystem\LoginSystem\LoginPage_ar.aspx.cs:line 20
   at LoginSystem.LoginPage_ar.ibtn_login_Click(Object sender, ImageClickEventArgs e) in H:\LoginSystem\LoginSystem\LoginPage_ar.aspx.cs:line 33
   at System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e)
   at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

今、私はMax Pool Size=400代わりにMax Pool Size=200

今までこのタイプのエラーはありませんでしたが、なぜこのメソッドがこの問題を引き起こすのか知りたいです。

4

1 に答える 1

1

これは暗闇での実際のショットなので、何か変更があればお知らせください

public static int IsValidPortalUser(string p_u, string p_p) 
{ 
    int item = 0; 
    using (IfxConnection ifxConnection = new IfxConnection(DB_Connection.connectionString)) 
    { 
        IfxCommand ifxCommand = new IfxCommand(); 
        string str = DB_Connection.My_Decryption_2(p_p); 
        try 
        { 
            if (ifxConnection.State == 0) 
                ifxConnection.Open(); 
            ifxCommand.Connection = idxConnection; 
            ifxCommand.CommandText = "SELECT nvl(emp_num,0) FROM htoemp WHERE username = ? 
                                      AND DECRYPT_CHAR(password, '78dfdf') = ? "; 
            ifxCommand.Parameters.AddWithValue("user_name", p_u); 
            ifxCommand.Parameters.AddWithValue("password", str); 
            IfxDataReader ifxDataReaders = ifxCommand.ExecuteReader(); 
            using (ifxDataReaders) 
            { 
                if (ifxDataReaders.Read()) 
                { 
                    item = (int)ifxDataReaders[0]; 
                } 
                ifxDataReaders.Close(); 
            } 
        } 
    } 
    return item; 
} 

また、Informix のバージョンによっては、文字列 password が予約済みキーワードです。

于 2012-07-25T10:47:49.937 に答える