Search Results

Search found 1 results on 1 pages for 'mtnviewmark'.

Page 1/1 | 1 

  • Cheapest way to to determine if a MySQL connection is still alive

    - by MtnViewMark
    I have a pool of MySQL connections for a web-based data service. When it starts to service a request, it takes a connection from the pool to use. The problem is that if there has been a significant pause since that particular connection has been used, the server may have timed it out and closed its end. I'd like to be able to detect this in the pool management code. The trick is this: The environment in which I'm coding gives me only a very abstact API into the connection. I can basically only execute SQL statements. I don't have access to the actual socket or direct access to the MySQL client API. So, the question is: What is the cheapest MySQL statement I can execute on the connection to determine if it is working. For example SELECT 1; should work, but I'm wondering if there is something even cheaper? Perhaps something that doesn't even got across the wire, but is handled in the MySQL client lib and effectively answers the same question?

    Read the article

1