vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| That's about the C api. I have a need to find out if a mysql connection is healthy or not, that is, is the server still up and able to serve queries, or not. How would I do it? mysql_error returns a lot of codes and it is unclear which ones are the ones to look for. i |
| ||||
| >That's about the C api. > >I have a need to find out if a mysql connection is healthy or not, >that is, is the server still up and able to serve queries, or not. > >How would I do it? > >mysql_error returns a lot of codes and it is unclear which ones are >the ones to look for. mysql_ping() seems to be useful for this sort of thing, assuming the connection is not currently in use with a query. If you've timed out it will reconnect. Or, give it some kind of trivial query that proves you have access to the tables you need, e.g. DESCRIBE tablename or SELECT * FROM tablename LIMIT 1 . Gordon L. Burditt |