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

The_Assimilator the.assimilator at gmail.com
Tue Jan 8 06:37:14 UTC 2013


The SqlConnection class is for use with MSSQL databases only. To connect to
a MySQL DB, you need the MySQL Connector/Net (
http://www.mysql.com/downloads/connector/net/) or similar library, which
provides the MySqlConnection class.


On Tue, Jan 8, 2013 at 4:13 AM, don rhummy <donrhummy at yahoo.com> wrote:

> 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" );
>     oConn.Open();
>
> 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?
>
>
>
>
> _______________________________________________
> Mono-aspnet-list mailing list
> Mono-aspnet-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-aspnet-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-aspnet-list/attachments/20130108/71d655d6/attachment.html>


More information about the Mono-aspnet-list mailing list