?
Solved

Can't connect to MySQL server (10048)

Posted on 2006-05-10
10
Medium Priority
?
939 Views
Last Modified: 2012-05-05
Can't connect to MySQL server on 'localhost'

I am getting this error when attempting to do a query on mysql.  The connection is setup on an Asp.NET ASPX page where it successfully queries for data.  Then, the connection is passed into a shared function (a class not on the asp.net page) and then fails.  The odd thing is this all works the first time around (page load) and then fails on the post back (second time around).

ERROR [HYT00] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'localhost' (10048)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.Odbc.OdbcException: ERROR [HYT00] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'localhost' (10048)

Source Error:


Line 496:
Line 497:        DBCommand = New System.Data.Odbc.OdbcDataAdapter(strSQL.ToString, conn)
Line 498:        DBCommand.Fill(DSPageData, "properties")
0
Comment
Question by:darneyman
  • 6
  • 4
10 Comments
 
LVL 16

Expert Comment

by:ellandrd
ID: 16650983
i think the code that is not in the .aspx page needs to access your code that connections to the mysql...

page.aspx <------ works fine correct?  this page has code to connect to mysql? yes?

another.aspx <----- connection error correct?  has it got access to mysql connection code?

0
 
LVL 16

Expert Comment

by:ellandrd
ID: 16650997
>>The odd thing is this all works the first time around (page load) and then fails on the post back (second time around).

"post back"  not very clear - confused!
0
 

Author Comment

by:darneyman
ID: 16651116
ellandrd:

Here's how it works:

page.aspx -- sets up mysql connection

then calls a function in a shared class ie: getdbdata.getData(passing in page.aspx's mysql connection);

So, the page sets up the connection and then passes it into this function in another class.  It is passing the connection to the class/function as a byval rather than byreference (if that makes a difference?)






0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
LVL 16

Expert Comment

by:ellandrd
ID: 16651166
yes it makes sense.

so its the passing the value of the connection is where the problem lies...

this shared class? why not try connection here since passing the connection from .aspx to class/function is causing problems?
0
 

Author Comment

by:darneyman
ID: 16651424
Yes, I have tried that.  Seems the issue is more insidious.  Looks like it was going through a loop and passing in this connection... to this function...
0
 
LVL 16

Accepted Solution

by:
ellandrd earned 750 total points
ID: 16651443
>>Looks like it was going through a loop and passing in this connection... to this function...

so have you got/found your answer?
0
 

Author Comment

by:darneyman
ID: 16651576
Well, it doesn't error out any longer.
0
 
LVL 16

Expert Comment

by:ellandrd
ID: 16651597
so your issue is resolved then?  is it working the way you want it?
0
 

Author Comment

by:darneyman
ID: 16651652
ellandrd:

Thanks for the help, this helped me focus on the issue.  I believe this particular issue is resolved.
0
 
LVL 16

Expert Comment

by:ellandrd
ID: 16651687
sorry i couldnt be of more help to get a grade A but hey at least your happy!

thank you

ellandrd ;-)
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question