Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Mysql connection

Newbie Spellweaver
Joined
Feb 18, 2007
Messages
21
Reaction score
0
Hello,

I recently added the DB to my webhost, cause I didn't want to have the DB on my computer.

Now the problem is, how to connect the server to the certain IP?

Code:
                Console.Title = "servername";
                Ini Config = new Ini(System.Windows.Forms.Application.StartupPath + @"\Config.ini");
                ServerIP = Config.ReadValue("Server", "ServerIP");
                ExternalDatabase.DBUserName = Config.ReadValue("Server", "DBUserName");
                ExternalDatabase.DBUserPass = Config.ReadValue("Server", "DBUserPass");

This doesn't say the ip connection.

Could anyone help me please?


Greetz
 
Experienced Elementalist
Joined
Jun 12, 2008
Messages
237
Reaction score
0
in the external db u can find
Code:
    public static bool Connect(string user, string pass)
    {
        try
        {
            Connection = new MySqlConnection("Server='localhost';Database='coproj';Username=" + MakeSafeString(user) + ";Password=" + MakeSafeString(pass));
            Connection.Open();
            return true;
        }
        catch
        {
            return false;
        }
    }
u have to modify "localhost" to ur DB hoster ip or site something like
Code:
    public static bool Connect(string user, string pass)
    {
        try
        {
            Connection = new MySqlConnection("Server='UrDBHostIP/Site!';Database='coproj';Username=" + MakeSafeString(user) + ";Password=" + MakeSafeString(pass));
            Connection.Open();
            return true;
        }
        catch
        {
            return false;
        }
    }
 
Back
Top