SQL Server log: Login succeeded for user APPL_ACCOUNT. Connection: Non-Trusted.
SQL Server log: Login succeeded for user 'APPL_ACCOUNT'. Connection: Non-Trusted.
I'm talking thousands in one morning. And I am suspecting that this is the cause of the performance degradation. I thought when you
conn.Open();
ADO.NET draws from connection pool using existing connections in the pool and you don't "login" again? Is this assumption right? I ran a very simple test:
using System;
using System.Data;
using System.Data.SqlClient;
static void Main(string[] args)
{
String s_conn = "Data Source=127.0.0.1;Initial Catalog=pubs;User Id=sa;Password=secret;Max Pool Size=80;Min Pool Size=30;";
IDbConnection oconn;
Int32 i;
oconn = new SqlConnection (s_conn);
for(i=0; i<100; i++)
{
oconn.Open();
oconn.Close();
}
return;
}
This did NOT generate a bunch of "Login succeeded" in my SQL Server's Server Log... but then the surprise is, there was NOT even ONE "Login succeeded"
Btw, I'm using NHibernate...
Dim _nhibernate_conn_factory ISessionFactory = BuildFactory() 'This is time consuming so we only create it once...
Public Function GetWarehouseNHibernateSession() As ISession Implements IWarehouseConnectionManager.GetWarehouseNHibernateSession
Dim conn As ISession
Dim maxRetry, retryFreq As Int32
Try
conn = nhibernate_conn_factory.OpenSession()
Catch ex As System.Data.SqlClient.SqlException
'handle the exception
Catch ex As Exception
'handle the exception
End Try
Return conn
End Function
My finding is, for each "OpenSession" there's a corresponding entry in SQL Server's log:
"SQL Server log: Login succeeded for user 'APPL_ACCOUNT'. Connection: Non-Trusted."
Is this normal? On one of my page there's 35 OpenSession - seems like this is what's slowing down the application. Advice? Thanks Thanks!
If you want to look deeper into NHibernate code, look
here (http://forum.hibernate.org/viewtopic.php?p=2292173#2292173)
ADO.NET Connection pooling REF:
http://www.15seconds.com/issue/040830.htm
NHibernate REF: http://nhibernate.sourceforge.net/NHibernateEg/NHibernateEg.Tutorial1A.html
Thanks!

