How To Enable/ Disable Auto Reconnect in MySQL �ϴ� ����� Ȱ��ȭ / ��Ȱ��ȭ mysql �ڵ� �翬�ῡ��

What is auto reconnect in MySQL? mysql �ڵ� �翬���� �����Դϱ�?
The MySQL client library can perform an automatic reconnect to the server if it finds that the connection is down when you attempt to send a statement to the server to be executed. the mysql Ŭ���̾�Ʈ ���̺귯���� �ڵ����� �ٽ� ������ ������ ���ֽ��ϴٰ� �߰��ϴ� ��� �������� ������ �Ʒ��� ������ ������ �õ��� �� ������ �����մϴ�. In this case, the library tries once to reconnect to the server and send the statement again. �� ��쿡�� ���̺귯���� ������ �ٽ� �����Ϸ��� �õ��� �� �� ���� ������ �ٽ� ����մϴ�.
Automatic reconnection can be convenient because you need not implement your own reconnect code, but if a reconnection does occur, several aspects of the connection state are reset and your application will not know about it. �ڵ����� �ٽ� ������ ������ ���ֽ��ϴ� �?�� �ֳ��ϸ� ��� �ڽ��� ���� �ڵ带 �ʿ䰡 ���,������ �ٽð� ���ϸ�, ���� ��鿡 ���� ���¸� �ٽ� �����Ͽ� ���� ���α��� �װͿ� ���� �� ������ϴ�. This is extremely useful if you long running persistent connections to the database. �̰��� �ſ� �� ��쿡 �����մϴ��� �����ͺ��̽��� �������� ������ �����մϴ�. Also if you have too many sql queries / use connection pool etc. auto reconnect is a handy feature. ���� �ʹ� ���� ��쿡�� sql �˻��� / ���� Ǯ���� ��� ��� �ڵ� �翬���� �?�� ������մϴ�. Let's look at how to enable / disable auto reconnect in MySQL and what are the side-effects of enabling auto reconnect. �� Ȱ��ȭ�ϴ� ��� ���� ���캸�� / ���� mysql �ڵ� �翬�ῡ�� �츮�� ������ Ȱ��ȭ �� - ������ �ڵ� �翬���մϴ�.
How to enable MySQL client auto reconnect mysql Ŭ���̾�Ʈ�� Ȱ��ȭ�ϴ� ��� �ڵ� �翬��
my_bool reconnect = 1; my_bool �翬�� = 1;
mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect); mysql_options (& mysql, mysql_opt_reconnect, & �翬��);
What are the side-effects of MySQL auto reconnect? - ������ ����� �����Դϱ� mysql �ڵ� �翬��?
- Any active transactions are rolled back and autocommit mode is reset. ��� Ȱ�� Ʈ������� �ѹ� �� autocommit ��尡�� �缳���մϴ�.
- All table locks are released. ��� ���̺��� ����� �����մϴ�.
- All TEMPORARY tables are closed (and dropped). ��� �ӽ� ���̺��� ��� (���� �϶�).
- Session variables are reinitialized to the values of the corresponding variables. ���� ������ �ش� ������ ������ �ٽ� �ʱ�ȭ�մϴ�. This also affects variables that are set implicitly by statements such as SET NAMES. �� ���� �Ͻ������� ������ ��ġ�� �������� ������ ���� �������� �̸��� �����մϴ�.
- User variable settings are lost. ����� ���� ������ �ս��մϴ�.
- Prepared statements are released. �غ�� ��ɹ��� �����մϴ�.
- HANDLER variables are closed. ó���� ������ ����մϴ�.
- The value of LAST_INSERT_ID() is reset to 0. �� ���� last_insert_id ()�� ������ 0�����մϴ�.
- Locks acquired with GET_LOCK() are released. ��� ��ġ�� ��� get_lock ()�� ����մϴ�.
- mysql_ping() does not attempt a reconnection if the connection is down. mysql_ping () �ٽ� ������ �õ����� �ʽ��ϴ� ������ ��쿡�� �Ʒ��մϴ�. It returns an error instead. ��ſ� �װͿ� ���� ��ȯ�մϴ�.
How to disable MySQL client auto reconnect mysql Ŭ���̾�Ʈ �ڵ� �翬�� ����� �����ϴ� ���
In view of the side-effects you may want to disable auto reconnect. - ȿ�� �� ���ִ� ��鿡�� ������� �ʵ��� ������ ���ֽ��ϴ� �ڵ� �翬���մϴ�. In MySQL version 5.1 and above auto reconnect is disabled by default. mysql ���� 5.1 �̻� �ڵ� �翬���� �⺻������ ������ �ʽ��ϴ�. In any version you can disable auto reconnect with the following PHP code: ��� ���� �ڵ� �ٽ� ������ ������ ���ֽ��ϴ� ������ ���� �ڵ� :
my_bool reconnect = 0; my_bool �翬�� = 0;
mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect); mysql_options (& mysql, mysql_opt_reconnect, & �翬��);
Filed under �ؿ� Database �����ͺ��̽��� , Enterprise Software ���� �������� ����Ʈ��� , Headline News ��� ���� ���� , How To �ϴ� ����� , Java Software �ڹ� ����Ʈ���� , MySQL mysql , Open Source Software ���� �ҽ� ����Ʈ���� , PHP php , Programming ���α��� , RDBMS rdbms , Tech Note ��� ��� ���� | |
| |
RSS 2.0 rss 2.0 | |
Trackback Ʈ���� this Article | �� ���� |
Email this Article ���� ������ ����
You may also like to read ������ ���� ���ֽ��ϴ� |





































October 17th, 2007 at 1:25 pm 2007�� 10�� 17�Ͽ��� ���� 1�� 25��
That��s not PHP code �װ� �ƴ� �ڵ�
C/C++ perhaps. c / c + + ��¼���մϴ�.
October 18th, 2007 at 1:08 pm 2007�� 10�� 18�Ͽ��� ���� 1�� 8��
It is PHP code. �� �ڵ��մϴ�. Check the fine manual �ϴ��� �̼� �Ŵ���
May 23rd, 2008 at 4:15 pm 2008�� 5�� 23�Ͽ��� ���� 4�� 15��
There��s no mysql_options() command listed anywhere in PHP documentation that I can find (trying to use it gives an ��undefined function�� error). �� ��� mysql_options () ����� ���� �ƹ� ���̳� php ������ ã�� ���־� (�װ��� ����Ϸ���� '���ǵ��� ���� �����'���� ���մϴ�). my_bool is definitely not a PHP variable type. my_bool�� Ȯ���� �ƴϰ�� php ������ �Է��մϴ�. PHP variables also need $��s, of which you have none. php ������ �ʿ� $ '��, �� ����� ����. I��m sorry, but this is NOT php code. �˼�������, �̰��� �ڵ��մϴ�.
You provide useful explanation of auto-reconnection functionality, but please don��t mislead people by claiming it��s useful code for PHP developers. ���ϰ� ������ ������ ������ �ڵ� - �ٽ� ���� ���, ����� �������� ���ʽÿ� �ִٰ� ���������� �װ��� ������ �ڵ带 php �����ڸ��մϴ�.