Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Connection Pooling

Reply
Thread Tools

Connection Pooling

 
 
ugurceng
Guest
Posts: n/a
 
      09-27-2005
Hi everbody ,

I need more info about connection pooling ,
We are developing a CRM project with ASP.NET and when more users connect to
the MS SQL DB at the same time , which problems would be occured ?
Our connection structure is like below what should you offer ?



' This is connection Class

Imports System.Data.SqlClient

Imports System.Configuration

Class CrmDBConn

Public Shared sqlconnBaglanti As SqlConnection

Public Shared Function connectToDB() As Boolean

Dim sqlstr As String

'sqlstr = ConfigurationSettings.AppSettings("ConnectionStrin g")

sqlstr = " data source=servername;uid=sa;password=12345;initial
catalog=CRM_DB"

sqlconnBaglanti = New SqlConnection(sqlstr)

Try

If sqlconnBaglanti.State <> ConnectionState.Open Then

sqlconnBaglanti.Open()

End If

Return True

Catch ex As Exception

Return False

End Try

End Function

End Class

************************************************** *

' This is any class that uses Connection class

Imports DataCRM.CrmDBConn

Imports System.Data.SqlClient

Public Class BankData

Shared Function bankInsertData(ByVal tds As dsBank) As Boolean

Dim strSqlString As String

Dim sqlAdap As New SqlClient.SqlDataAdapter

Dim dset As New DataSet

If connectToDB() = False Then

'Redirect error page

Exit Function

End If

Dim thisRow As dsBanka.ARG_CRM_BANKARow =
tds.ARG_CRM_BANKA.Rows(tds.ARG_CRM_BANKA.Rows.Coun t - 1)

strSqlString = "INSERT INTO ................"

Dim cmdInsert As SqlCommand = New SqlCommand(strSqlString, sqlconnBaglanti)

cmdInsert.ExecuteNonQuery()

FillCombo.initBankData()

sqlconnBaglanti.Close()

Return (True)

End Function

So when I call the bankInsertData func. I request a connection from
connection pool, As I know a connection pool has 100 connectios, so at the
same time 110 users call this func. what will be? And how can I know that
how many connections are being used at any time? Using a counter ?

One more thing , when we change the connection string a new connection pool
is being created, So if we request more than 100 connection from connection
pool ,the only way is to change the connection string to crate new conn
pool?

Best regards...

UGURCENG


 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      09-27-2005
Note that shared variables are shared accross the whole application. For
ASP.NET it means that all users are sharing the same connection making it a
bottleneck.
The usual scheme is rather to create/release them as needed (pooling takes
care from efficient reuse of previous connections).

You can control the size of the pool but if you have the very first thing to
check before doing so is to see if you don't have connections left open.

--
Patrice

"ugurceng" <> a écrit dans le message de
news:%...
> Hi everbody ,
>
> I need more info about connection pooling ,
> We are developing a CRM project with ASP.NET and when more users connect

to
> the MS SQL DB at the same time , which problems would be occured ?
> Our connection structure is like below what should you offer ?
>
>
>
> ' This is connection Class
>
> Imports System.Data.SqlClient
>
> Imports System.Configuration
>
> Class CrmDBConn
>
> Public Shared sqlconnBaglanti As SqlConnection
>
> Public Shared Function connectToDB() As Boolean
>
> Dim sqlstr As String
>
> 'sqlstr = ConfigurationSettings.AppSettings("ConnectionStrin g")
>
> sqlstr = " data source=servername;uid=sa;password=12345;initial
> catalog=CRM_DB"
>
> sqlconnBaglanti = New SqlConnection(sqlstr)
>
> Try
>
> If sqlconnBaglanti.State <> ConnectionState.Open Then
>
> sqlconnBaglanti.Open()
>
> End If
>
> Return True
>
> Catch ex As Exception
>
> Return False
>
> End Try
>
> End Function
>
> End Class
>
> ************************************************** *
>
> ' This is any class that uses Connection class
>
> Imports DataCRM.CrmDBConn
>
> Imports System.Data.SqlClient
>
> Public Class BankData
>
> Shared Function bankInsertData(ByVal tds As dsBank) As Boolean
>
> Dim strSqlString As String
>
> Dim sqlAdap As New SqlClient.SqlDataAdapter
>
> Dim dset As New DataSet
>
> If connectToDB() = False Then
>
> 'Redirect error page
>
> Exit Function
>
> End If
>
> Dim thisRow As dsBanka.ARG_CRM_BANKARow =
> tds.ARG_CRM_BANKA.Rows(tds.ARG_CRM_BANKA.Rows.Coun t - 1)
>
> strSqlString = "INSERT INTO ................"
>
> Dim cmdInsert As SqlCommand = New SqlCommand(strSqlString,

sqlconnBaglanti)
>
> cmdInsert.ExecuteNonQuery()
>
> FillCombo.initBankData()
>
> sqlconnBaglanti.Close()
>
> Return (True)
>
> End Function
>
> So when I call the bankInsertData func. I request a connection from
> connection pool, As I know a connection pool has 100 connectios, so at

the
> same time 110 users call this func. what will be? And how can I know that
> how many connections are being used at any time? Using a counter ?
>
> One more thing , when we change the connection string a new connection

pool
> is being created, So if we request more than 100 connection from

connection
> pool ,the only way is to change the connection string to crate new conn
> pool?
>
> Best regards...
>
> UGURCENG
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection Pooling, Dispose/Close/Using =?Utf-8?B?UGllcnNvbiBD?= ASP .Net 9 11-26-2008 02:58 PM
Connection pooling =?Utf-8?B?VmFtJHk=?= ASP .Net 1 11-24-2004 09:45 AM
Re: SqlConnection and connection pooling William \(Bill\) Vaughn ASP .Net 0 11-14-2003 07:27 PM
connection pooling error Chris Szabo ASP .Net 6 08-19-2003 07:19 PM
connection pooling Trevor Hartman ASP .Net 2 07-28-2003 07:58 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57