Hi,
I'm building a MySQL C API client. I need to connect to different dbs
at the same time. My code is (approximately):

//============================
MYSQL mysql, *conn1, *conn2;

mysql_init(&mysql)

 conn1 = mysql_real_connect(&mysq, ip1, user1, pass1, db1, 0, NULL, 0)
 printf("conn1 = %d", conn1);

 conn2 = mysql_real_connect(&mysq, ip2, user2, pass2, db2, 0, NULL, 0)
 printf("conn2 = %d", conn1);

 conn3 = mysql_real_connect(&mysq, ip3, user3, pass3, db3, 0, NULL, 0)
 printf("conn3 = %d", conn3);

 // ... use conn1
 // ... use conn2
 // ... use conn3

 mysql_close(conn1);
 mysql_close(conn2);
 mysql_close(conn3);

mysql_close(&mysql);
//============================

I see always that (conn1 == conn2), so the first connection is lost.
Could you give some explanation about this?
How can I mantain different connections on different db (ip, user,
etc....)?



==================================================================
Valerio Ferrucci                        Tabasoft Sas
[EMAIL PROTECTED]                      http://tabasoft.ancitel.it
                                        [EMAIL PROTECTED]



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to