Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 MySQL - Error Too many connections

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-12-19 : 09:03:30
RAJGOPAL writes "Hi All,

I need help from any MySql Expert.

I am facing Database connectivity (Exceeding max number of connections) issue. It throws an error saying
"Too many connections".

I tried increasing the connections but still we are getting the same error. Can anyone guide us to fix this issue ?!

I am using MySQL for may ASP.NET application in windows. I am using MYSQL Server Version 5.0.16-nt and the client version 5.0.11.

From the ASP.NET application I am connecting with the help of ODBC connectivity.

Here is my sample code how i connect to MYSQL Server
----------------------------------------------------------------
Public Shared Function OpenDBConnection() As Odbc.OdbcConnection
Dim sConString As String
Dim objConn As New INGwebConfig.dbParameters
Dim pOleConnection As Odbc.OdbcConnection
Dim pRDBMS As String
Try
sConString = ConfigurationSettings.AppSettings
pOleConnection = New Odbc.OdbcConnection(sConString)
pOleConnection.Open()
pOleConnection.ReleaseObjectPool()
pOleConnection.Dispose()
OpenDBConnection = pOleConnection
Catch ex As Exception
End Try
End Function
----------------------------------------------------------------
Is there some thing that is missing.


Thanks,
Raj"

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2005-12-19 : 09:35:22
First, SQLTEam is primarily a Microsoft SQL Server support resource. There are occasional mysql questions here and I usually do my best to help answer, but www.dbforums.com is probably a better resource to use for mysql specific questions. Anyway, I'll give it my best shot..

I assume you have bumped max_connections in the my.ini to something larger than 100. 100 is default btw. First I would double check that all connections are actually in use (show processlist from mysql).

If they are all in use then you have some kind of connection leak issue with your code. These types of connection leaks typically happen if you throw an exception in your code before you can close or dispose of the connection. I would look around online for examples of how to properly open and close connections to ensure this does not happen.

You can also disable connection pooling (on by default) and see if that helps. There is also a variable called wait_timeout that you can use (default is 28800 seconds) to close idle connections.

Also, why are you using the ODBC driver for your .NET app? MySQL has a ADO.NET driver that is probably a better choice for you to use.

hth.



-ec

Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-12-19 : 11:05:28
also you could check out www.mysql.org to be specific with mysql and for connections www.connectionstrings.com

Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2005-12-19 : 20:38:11
You could use a real database



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2005-12-19 : 23:15:24
quote:
Originally posted by Merkin

You could use a real database



Oracle might be too pricey though
Go to Top of Page
   

- Advertisement -