Amiga.org

The "Not Quite Amiga but still computer related category" => Alternative Operating Systems => Topic started by: TheMagicM on March 15, 2005, 09:33:20 PM

Title: Accessing a MySQL db from C
Post by: TheMagicM on March 15, 2005, 09:33:20 PM
so I have a simple piece of code that connects to my db. It works if I run it direct on the mysql server..but I want to be able to access that db w/that software on another machine on the internal network. If my server
is for example 192.168.0.7 am I supposed to connect to a specific port?

-Alex
Title: Re: Accessing a MySQL db from C
Post by: adolescent on March 16, 2005, 01:22:25 AM
What connector are you using?  ODBC?  I've only done .Net programming using ODBC, and the native connectors but maybe I can help.
Title: Re: Accessing a MySQL db from C
Post by: TheMagicM on March 16, 2005, 03:32:19 AM
I'm connecting directly using this:

if ( !mysql_real_connect ( &mysql , "localhost" , "username" etc etc


but I ran it on my development machine and substituted 192.168.0.7 which is the ip address to the server which I recieved a could not connect response.  But that same compiled code run on the server gets a connect message.
Title: Re: Accessing a MySQL db from C
Post by: adolescent on March 16, 2005, 04:56:42 AM
The default port is 3306.  Are you specifying this?  (although, if I read the docs correctly, it's not required unless you want to force the connection to use named pipes).
Title: Re: Accessing a MySQL db from C
Post by: TheMagicM on March 16, 2005, 12:33:30 PM
no..I just substitute localhost w/192.168.0.7 ...  
Title: Re: Accessing a MySQL db from C
Post by: TheMagicM on March 16, 2005, 03:50:07 PM
ok, after some thinkin.. I think I need to go into mysqlcc and where i have the users setup.. I have @localhost... I need to add @ and that should take care of it.