Error: Too many connections
Posted by: Valere Palhories
Date: February 21, 2005 07:20AM

Hello,

I have a MySql server (4.1) that we use with an ASP.NET (1.1) app that we have created. The MySql Server has 100 maximum connections. We have a total of 7 users on our application. All of our queries open the the database, process the query and immediately close the connection. About 1 hour after everyone starts using the app, they cannot access the data because they get the message too many connections. I double checked the code and we are in fact closing the connection every time. In other words, we're running without a persistent connection.

When I open MySql Administrator and look at the connections, I can in fact see all 100. The command column says "Sleep" for all 100 connections.

Private Shared Sub ConnectMySql(ByVal Server As String, ByVal UserId As String, ByVal Password As String, ByVal DBName As String)

Dim strConnectionString As String
strErrorMsg = ""

strConnectionString = "server=" & Server & ";"
strConnectionString &= "user id=" & UserId & ";"
strConnectionString &= "password=" & Password & ";"
strConnectionString &= "database=" & DBName & ";"
strConnectionString &= "pooling=true;"
strConnectionString &= "Protocol=TCP;"
strConnectionString &= "Min Pool Size=1;"
strConnectionString &= "Max Pool Size=99;"
strConnectionString &= "Connection Lifetime=0"

Try
SaberTooth = New MySqlConnection(strConnectionString)
SaberTooth.Open()
Catch ex As MySqlException
strErrorMsg = ex.Message
End Try

End Sub

I execute my query and close the database as follows:

If Not SaberTooth Is Nothing Then
If SaberTooth.State = ConnectionState.Open Then
SaberTooth.Close()
End If
End If

Any ideas on what I'm doing wrong?

Thanks

-- Val

Options: ReplyQuote


Subject
Written By
Posted
Error: Too many connections
February 21, 2005 07:20AM
February 23, 2005 03:22AM
November 29, 2005 12:37AM
December 19, 2005 06:25AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.