+ Reply to Thread
Results 1 to 3 of 3

Thread: ASP.Net file unable to connect remote MySql Server

  1. #1
    ml123me is offline x10Hosting Member ml123me is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    3

    Question ASP.Net file unable to connect remote MySql Server

    Hi,

    I have created database on absolut.x10hosting.com (IP 115.96.178.41) with database name ml123me_test.

    After that i uploaded my project files to the CPanel. Following is the code


    Default.aspx

    <%@ Page Language="C#"%>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="MySql.Data.MySqlClient" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <script runat="server">
    private void Page_Load(Object sender, EventArgs e)
    {
    string connectionString = "server=absolut.x10hosting.com;Database=ml123me_te st;userid=ml123me;password=******;Pooling=false;";
    MySqlConnection dbcon = new MySqlConnection(connectionString);
    dbcon.Open();

    MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM emp", dbcon);
    DataSet ds = new DataSet();
    adapter.Fill(ds, "emp");

    dbcon.Close();
    dbcon = null;

    GridView1.DataSource = ds.Tables["emp"];
    GridView1.DataBind();
    }
    </script>
    <head runat="server">
    <title>Untitled Page</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <asp:GridView ID="GridView1" runat="server"></asp:GridView>
    </form>
    </body>
    </html>



    It gives as error as follows :

    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]




    If i change the server to the IP address 115.96.178.41

    It gives error as follows :

    MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts.
    at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000]
    at MySql.Data.MySqlClient.Driver.Open () [0x00000]
    at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuild er settings) [0x00000]
    at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00000]




    Please help me on this topic.

    Thanks in advance.
    Last edited by ml123me; 02-01-2010 at 01:42 PM.

  2. #2
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: ASP.Net file unable to connect remote MySql Server

    The MySQL host is localhost. The remote MySQL feature has been disabled on the free servers.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  3. #3
    ml123me is offline x10Hosting Member ml123me is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    3

    Question Re: ASP.Net file unable to connect remote MySql Server

    Thanks for the help.

    But even if i make server as a localhost in connection string it gives following error


    Server Error in '/' Application

    Connection refused Description: HTTP 500. Error processing request.
    Stack Trace:
    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]
    Version information: Mono Version: 2.0.50727.1433; ASP.NET Version: 2.0.50727.1433



    Please let me know if some changes need to be done.

+ Reply to Thread

Similar Threads

  1. [PHP] MySQL and PHP
    By Bryon in forum Tutorials
    Replies: 43
    Last Post: 03-24-2011, 07:27 AM
  2. Replies: 4
    Last Post: 01-07-2010, 09:16 AM
  3. Replies: 1
    Last Post: 10-08-2009, 08:08 AM
  4. Connect to MySql (asp.net)
    By shdus1 in forum Programming Help
    Replies: 1
    Last Post: 08-02-2009, 02:06 PM
  5. New Site-Suggestions?
    By mnoutside in forum Review My Site
    Replies: 9
    Last Post: 08-27-2008, 07:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers