Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everybody,

I have a website which take advantage of MySQL database and PhpMyAdmin. I've created a database (My_db) and assigned a username and password to it as an admin (db_admin). This username is differed from my control panel username (CPanel_user). I also created a table and inserted some data to it (tbl_test).

What I want to do is develop a client program using this database. The problem is that I don't know the proper connection string to this remote database. I downloaded MySQL connector for windows and installed it in order to add my database to ODBC data sources but it wasn't successful because I don't know what parameters I should use in the needed fields.

I used try and error method too but it didn't help.

Can anyone help me and answer how can i add a remote MySQL database to ODBC data sources and gain access to it via a remote client?
Posted
Updated 22-Apr-11 0:27am
v2

MySQL connecting in e.g. C# is advance coding. It's easier to connect an MS SQL database to your system. But with this piece of code it should work. Good luck!!

using namespace sql;

Driver *driver;
Connection *con;

try {
    driver = get_driver_instance();
    con = driver -> connect("tcp://127.0.0.1:3306/test", "root", "admin");
} catch (..) {
    ..
}
 
Share this answer
 
It may not be a connection string issue here. The remote server may not be setup for accepting outside connections. If so an outside client will not be able to see or connect to the database.

You could expose the database indirectly through a web-service, even something as simple as a JSON service. And your clients talk to the database through this service.
 
Share this answer
 
first of all, u need to make sure the database server accept remote connection, and then you have the MySQL connector installed, and then you can just make a new MySqlConnection with the server name (ip address of the remote server and the port the mysql is installed), username, password, and database name.

you can read more on how to enable remote connection on mysqlhere[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900