Hi,
I'm building a C API MySQL 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 == conn3), so the prevuoius connection
are overwritten.
Could you give some explanation about this?
How can I mantain different connections on different db (or different
ip, user, etc....)?

Thanks
==================================================================
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