[Mono-list] ASP.NET and MySQL

Brown, Robert rpbrown at GAIC.COM
Fri Sep 22 12:32:34 EDT 2006

Have you tried specifying the port in the connection string?


-----Original Message-----
From: mono-list-bounces at lists.ximian.com
[mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Loren Bandiera
Sent: Friday, September 22, 2006 12:23 PM
To: mono-list
Subject: [Mono-list] ASP.NET and MySQL


I'm trying to get an ASP.NET application working with Mono running under
Linux. I want to use MySQL for the database so I got the MySQL
Connector/Net 1.0.7.

If I write a small command line program that just does this:

MySqlConnection conn = new MySqlConnection("Server=<ip
address>;Database=foo;User ID=test;Password=test;Pooling=false");
conn.Open ();

That works fine. It connects to the remote server and prints out the
server version (5.0.24a-log). 

However, if write a small ASP.NET form and try and execute that same
code from Page_load() it fails. This is the trace that xsp2 gives me:

MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the
specified MySQL hosts ---> System.Net.Sockets.SocketException: No such
host is known
  at System.Net.Dns.GetHostByName (System.String hostName) [0x00000]
  at MySql.Data.Common.StreamCreator.GetStream (Int32 timeOut) [0x00000]
  at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] --- End of
inner exception stack trace ---

  at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000]
  at MySql.Data.MySqlClient.Driver.Create
(MySql.Data.MySqlClient.MySqlConnectionString settings) [0x00000]
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00000] 

I'm at a loss for why it works from the command line but not from within
an ASP page. It's the same connection string, server, etc.

Anyone seen this behavior before? Got any suggestions?

Loren Bandiera <lorenb at mmgsecurity.com>
MMG Security, Inc.

Mono-list maillist  -  Mono-list at lists.ximian.com

The content of this e-mail message and any attachments are confidential
and may be legally privileged, intended solely for the addressee. If you
are not the intended recipient, be advised that any use, dissemination,
distribution, or copying of this e-mail is strictly prohibited.  If you
receive this message in error, please notify the sender immediately by
reply email and destroy the message and its attachments.

More information about the Mono-list mailing list