List:MySQL++« Previous MessageNext Message »
From:Jim Date:January 9 2008 5:02pm
Subject:Re: mysql++ 3.0 beta2 Connecting troubles
View as plain text  
Bart Verstraete wrote:
>
>> Try running a program using the mysql api.  If it works OK then it 
>> may be a mysql++ problem but if you can't get a program using the 
>> mysql api working, it isn't mysql++.
>>
>> This should get you started:
>>
>> Testm.cpp
>> #include <mysql/mysql.h>
>> #include <string>
>> #include <iostream>
>> #define AMYSQL_PORT 3307
>>
>> using namespace std;
>>
>> int main(int argc, char **argv)
>> {
>>
>>    static MYSQL *conptr, *tptr;
>>    string host="";
>>    string uname="";
>>    string upass="";
>>    string db="";
>>    conptr = mysql_init (conptr);
>>    tptr = mysql_real_connect (
>>               conptr, host.c_str(), uname.c_str(), upass.c_str(), 
>> db.c_str(), AMYSQL_PORT, NULL, 0);
>>    if(tptr == NULL) {
>>        cout <<"Failed to connect"<<endl;
>>    }
>> }
>>
>> Of course, fill in the empty strings with something that will work.
>>
>> Jim.
>>
> I tried it, it connects fine so its mysql++?
>
>
I'm not the last word on this, but I'd say it is most likely not a 
permission issue as suggested earlier.

So you are asking in the right place.  I assume that you pass the exact 
same parameters to connect?

I notice you use the connect(...) call.  Have you tried something like:

       mysqlpp::Connection con (dbname,host),
                user, password);

Not that I'd expect it to work any better.  It is the preferred way to 
connect, per the manual.

Jim.



Thread
mysql++ 3.0 beta2 Connecting troublesBart Verstraete6 Jan
  • Re: mysql++ 3.0 beta2 Connecting troublesJonathan Wakely6 Jan
    • Re: mysql++ 3.0 beta2 Connecting troublesBart Verstraete7 Jan
      • Re: mysql++ 3.0 beta2 Connecting troublesJim7 Jan
        • Re: mysql++ 3.0 beta2 Connecting troublesBart Verstraete8 Jan
          • Re: mysql++ 3.0 beta2 Connecting troublesJim9 Jan
            • Re: mysql++ 3.0 beta2 Connecting troublesBart Verstraete10 Jan
              • Re: mysql++ 3.0 beta2 Connecting troublesBart Verstraete10 Jan
                • Re: mysql++ 3.0 beta2 Connecting troublesBart Verstraete10 Jan
                  • Re: mysql++ 3.0 beta2 Connecting troublesWarren Young11 Jan
  • Re: mysql++ 3.0 beta2 Connecting troublesWarren Young7 Jan
    • Re: mysql++ 3.0 beta2 Connecting troublesBart Verstraete8 Jan
      • Re: mysql++ 3.0 beta2 Connecting troublesWarren Young8 Jan
        • Re: mysql++ 3.0 beta2 Connecting troublesBart Verstraete8 Jan
          • Re: mysql++ 3.0 beta2 Connecting troublesWarren Young8 Jan
            • Re: mysql++ 3.0 beta2 Connecting troublesBart Verstraete10 Jan
              • Re: mysql++ 3.0 beta2 Connecting troublesWarren Young11 Jan