Similar Threads:
1.connection in connection pool with pooling=false
I'm finding that even when pooling=false, a connection remains in my
connection pool connected to my database (it seems to quite quickly timeout
though - say 30 seconds).
My connection string:
Initial Catalog=Benji_UnitTest;Data Source=.;Integrated
Security=SSPI;Pooling=false
Using this setting, I would expect that a new connection be created
everytime, and that when the SqlConnection is close()'d (i.e., returned to
the "pool") that the underlying database connection would be closed.
I also tried setting ";Connection Lifetime=1" in order to get the connection
to close quickly (as a worksround); this didn't seem to affect any change.
Am I misunderstanding something?
Thanks,
j
2.Help Requried on Connection Pooling [Urgent]
Hi ,
i have a requriment where i need to perform connection pooling through
c#.net code .My database is Sybase.
Can any one forward me link or suggest me on how to start to write code for
this.
Regards
Mani.
3.Problems in Connection pooling. Urgent
4.Problems in Connection pooling: Urgent
Hello All,
My windows application has a form that needs to display fresh data to the
user at short intervals (say every 10 seconds). For this purpose, I have
included a timer. On every timer tick, I perform the database related
operations to display the result to the user.
Note: Multiple instances of my application will be running at the same time
and hence the timer running in each instance and initiation database
operations.
With this approach, I started receiving errors like: Connection timed out.
The connection pool has reached its maximum size because every request to
the database opened and closed a connection. I changed the approach to:
Creating a single connection for the entire form so that all operations use
the same open connection. The connection is closed when the form closes.
Even then, I now get the following type of errors:
a) 8/11/2003 3:21:40 PM SqlUtility Execute Error: Transaction
(Process ID 73) was deadlocked on lock resources with another process and
has been chosen as the deadlock victim. Rerun the transaction.
TimeTic Calling sp_ProductionTestBackgroundTask at
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior,
RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at IMD.OM.Database.SqlUtility.Execute(SqlParameter& prmOutParam,
SqlConnection cnnCommon) in
d:\khyatis\work\projects\imd\imdom\misc\sqlutility.cs:line 595
8/11/2003 3:21:40 PM SC Status Start NSC Monitor Error: at
OM.Database.SqlUtility.Execute(SqlParameter& prmOutParam, SqlConnection
cnnCommon) in d:\xyz\work\projects\\misc\sqlutility.cs:line 608
at IMD.OM.SC.SCStatus.StartNSCMonitor(SqlConnection commonConnection) in
d:\xyz\work\projects\scstatus.cs:line 564System.Data.SqlClient.SqlException:
Transaction (Process ID 73) was deadlocked on lock resources with another
process and has been chosen as the deadlock victim. Rerun the transaction.
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at IMD.OM.Database.SqlUtility.Execute(SqlParameter& prmOutParam,
SqlConnection cnnCommon) in d:\xyz\work\projects\\misc\sqlutility.cs:line
595
I need to get rid of the above problem.
Regards,
Mithun
5.Leftover Connections in Connection Pool (connection leak)
This never happened before in .NET Framework 1.0 nor .NET Framework
1.1, but connection leak happens if you don't close the connection when
you use SqlTransaction. I would like to share this information with the
MS dev community.
We had this issue of SQL Server performing very poorly while running
our application. My colleague found out that connection leak was
happening whenever the .NET code executed transactions. So I created a
small console program that does a transaction like the following.
Imports System.Data
Imports System.Data.SqlClient
Module Module1
Sub Main()
Begin:
Dim Conn As SqlConnection = GetConnection()
Conn.Open()
Dim Trans As SqlTransaction =
Conn.BeginTransaction(IsolationLevel.ReadUncommitted)
Dim Cmd As New SqlCommand("tblTest_ins", Trans.Connection, Trans)
Cmd.CommandType = CommandType.StoredProcedure
For i As Integer = 1 To 50
Console.WriteLine("Executing stored proc. (" & i.ToString() & ")")
Dim parTestCol As New SqlParameter()
With parTestCol
.ParameterName = "@TestCol"
.Direction = ParameterDirection.Input
.SqlDbType = SqlDbType.NVarChar
.Size = 50
.SqlValue = "TestValue " & DateTime.Now.ToString()
End With
Cmd.Parameters.Add(parTestCol)
Cmd.ExecuteNonQuery()
Cmd.Parameters.Clear()
Next
Trans.Commit()
Console.WriteLine("Execution Completed")
Dim Entry As ConsoleKeyInfo = Console.ReadKey()
If Entry.Key = ConsoleKey.Y Then
GoTo Begin
Else
Return
End If
End Sub
Private Function GetConnection() As
System.Data.SqlClient.SqlConnection
Dim Conn As New
SqlConnection("server=(local);database=Test;Pooling=true;user
id=sa;password=whatever;Application Name=HelloConnPool;connection
reset=true;")
Return Conn
End Function
End Module
I ran this code many times, and connection leak was happening. So I
added Conn.Close() right after Trans.Commit(), then the leak was gone.
Well, I could have done Trans.Connection.Close(), but the thing was
that right after the transaction was committed, Connection property was
null. So as we have a data layer that doesn't expose the underlying
connection, we had to define a variable as SqlConnection and hold onto
the reference to the connection from the transaction and the close it
after commit.
I hope I explained this issue well, but this never happened in .NET
Framework 1.1. We converted our code from 1.1 to 2.0, and didn't change
a thing, but this issue came out. I hope this will help people who
experience the same kind of issue. If you have any question, please
just post it here.
6. Pooled connection error
7. Trap "connection pool" errors [crosspost from .asp]
8. "General Network Error" and Connection Pooling