[Mono-aspnet-list] Unable to connect to MySQL database with SqlConnection!

Childs, Aaron aaron at westfield.ma.edu
Tue Jan 8 02:28:48 UTC 2013


To connect to a MySQL database you need to use MySqlConnection, SqlConnection is for MSSQL.

Have a good day,

[Description: Description: Description: logo-email]

Aaron Childs, CCNA
Associate Director, Networking
Information Technology
Please Note: new e-mail address - aaron at westfield.ma.edu<mailto:aaron at westfield.ma.edu>

From: mono-aspnet-list-bounces at lists.ximian.com [mailto:mono-aspnet-list-bounces at lists.ximian.com] On Behalf Of don rhummy
Sent: Monday, January 07, 2013 9:13 PM
To: mono-aspnet-list at lists.ximian.com
Subject: [Mono-aspnet-list] Unable to connect to MySQL database with SqlConnection!

I get the error "Connection Refused"! I have the connection string correct from what I can tell. Both the DB and ASP.Net are on the same server.

    SqlConnection oConn = new SqlConnection( "Server=localhost;Database=testDB;Uid=root;Pwd=mypass" );

I get this error:

System.Net.Sockets.SocketException: Connection refused

  at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remote_end) [0x00000]

  at System.Net.Sockets.Socket+Worker.Connect () [0x00000]

Those exact connection settings work if I do it through ODBC and use a DSN. Why can't I get SqlConnection to work?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-aspnet-list/attachments/20130108/13bd4d3c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 8578 bytes
Desc: image001.jpg
URL: <http://lists.ximian.com/pipermail/mono-aspnet-list/attachments/20130108/13bd4d3c/attachment.jpg>

More information about the Mono-aspnet-list mailing list