Hi
 
I got problem connecting to MySQL Database on Mono. I can run the webservices. But when ever I try to invoke the database from webservices it kept giving me this error
 
The remote server returned an error: (500) Internal Server Error.
Unable to connect to any of the specified MySQL hosts
 
I am using ByteFX and also MySQL connector/Net. These are working fine on Windows Platform when I tested with .Net. On Linux it cannot connect to database. What could be the problem?
 
I put the MySQL connector/Net version of code with this mail.
 

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Diagnostics;

using System.Web;

using System.Web.Services;

using MySql.Data.MySqlClient;

namespace ws

{

/// <summary>

/// Summary description for Service1.

/// </summary>

public class Fotohub : System.Web.Services.WebService

{

public Fotohub()

{

//CODEGEN: This call is required by the ASP.NET Web Services Designer

InitializeComponent();

}

#region Component Designer generated code

//Required by the Web Services Designer

private IContainer components = null;

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if(disposing && components != null)

{

components.Dispose();

}

base.Dispose(disposing);

}

#endregion

 

[WebMethod]

public DataSet GetUserInfo()

{

string connectionString= "server=localhost; uid=root; pwd=koko; database=fotows";

string query= "Select * From user";

DataSet dataset=new DataSet();

MySqlConnection conn = new MySqlConnection(connectionString);

MySqlDataAdapter adapter = new MySqlDataAdapter();

adapter.SelectCommand = new MySqlCommand(query, conn);

adapter.Fill(dataset);

return dataset;

}

}

}

 

regards,

Ko Ko



Reality starts with Dream


Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.
_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to