Jump to content

Connecting to database in helionet using C#


Recommended Posts

Below is the code I am using to connect :

 

private void Initialize()

{

server = "http://thefarmersmarketplace.heliohost.org";

database = "khemkas_social";

userName = "Something"; //changed for security reasons.

password = "something";

string connectionString;

connectionString = "SERVER=" + server + ";" + "DATABASE=" +

database + ";" + "UID=" + userName + ";" + "PASSWORD=" + password + ";";

 

connection = new MySqlConnection(connectionString);

}

 

However, I am not able to connect to the database. What should the server be. I am doing anything wrong

Link to comment
Share on other sites

If the code is hosted on the server, you should be using "localhost" as the server. Otherwise, you're might want to use "stevie.heliohost.org" or "216.218.192.170". I'm not sure if you need to include "http://" at the beginning of the server address, so try without "http://" first. If that doesn't help, just add it in to see if it helps.

 

I hope I was clear,

 

~Derek

Link to comment
Share on other sites

If the code is hosted on the server, you should be using "localhost" as the server. Otherwise, you're might want to use "stevie.heliohost.org" or "216.218.192.170". I'm not sure if you need to include "http://" at the beginning of the server address, so try without "http://" first. If that doesn't help, just add it in to see if it helps.

 

I hope I was clear,

 

~Derek

 

 

Hey, I tried your solution. now i get this : Access denied for user 'khemkas_root'@'nusnet-213-192.dynip.nus.edu.sg' (using password: YES)". Why does it add things after @. I never added them.

 

below is the code

private void Initialize()

{

server = "stevie.heliohost.org";

database = "khemkas_social";

userName = "khemkas_root";

password = "something";

string connectionString;

connectionString = "SERVER=" + server + ";" + "DATABASE=" +

database + ";" + "UID=" + userName + ";" + "PASSWORD=" + password + ";";

 

connection = new MySqlConnection(connectionString);

}

 

thanks

Link to comment
Share on other sites

Hey, I tried your solution. now i get this : Access denied for user 'khemkas_root'@'nusnet-213-192.dynip.nus.edu.sg' (using password: YES)". Why does it add things after @. I never added them.

 

The error is saying that the user "khemkas_root" at (<--- That's why there's an @ sign) the server "nusnet-213-192.dynip.nus.edu.sg".

 

Did you use localhost? Usually if you use localhost, the server is "localhost".

 

 

If you didn't, your sql user might not have been "added" to your database. You can do that in the MySQL wizard in your cPanel.

 

Also, if your C# program isn't located on the Heliohost server, then you could try adding the IP address of where the C# program actually is in your MySQL Remote Access list (in your cPanel).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...