Sql Server as logging, best connection practise

Posted by ozz on Stack Overflow See other posts from Stack Overflow or by ozz
Published on 2012-09-06T20:42:47Z Indexed on 2012/09/06 21:38 UTC
Read the original article Hit count: 166

Filed under:
|
|

I'm using SqlServer as logging. Yes this is wrong decision, there are better dbs for this requirement. But I have no other option for now.

Logging interval is 3 logs per second.

So I've static Logger class and it has static Log method.

Using "Open Connection" as static member is better for performance. But what is the best implemantation of it?

This is not that I know.

public static class OzzLogger
{
    static SqlConnection Con;

    static OzzLogger()
    {
       Con=ne SqlConnection(....);
       Con.Open();  
    }

    public static void Log(....)
    {
       Con.ExecuteSql(......);
    }
}

UPDATE

I asked because of my old information. People say "connection pooling performance is enough". If there is no objection I'm closing the issue :)

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about logging