Overview
Features
Download
Documentation
Community
Add-Ons & Services

MySQL Session

Please post support and help requests here.

MySQL Session

Postby sprkrt » 30 May 2012, 20:03

I have a MySQL session and to check against timeouts. I was using session->isConnected()

I'm guessing that this will not work and I would have to do some sort of ping check using a query like: 'select 1'


Is Session::isConnected() not supposed to return false if the session was closed due to something timing out?
sprkrt
 
Posts: 15
Joined: 22 Aug 2011, 23:25

Re: MySQL Session

Postby alex » 30 May 2012, 22:41

sprkrt wrote:Is Session::isConnected() not supposed to return false if the session was closed due to something timing out?

In theory, yes. I have no experience with MySQL but I found isConnected()to be highly unreliable with ODBC (Oracle in particular - it will return true when connection has, in fact, been lost), so I had to resort to running a dummy query and catching exception.
alex
 
Posts: 1130
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: MySQL Session

Postby Royce » 05 Jun 2012, 04:33

I put auto-reconnect=true in my connection string and called it a day. It eliminated my "mysql server has gone away" exceptions due to idle timeouts.
Royce
 
Posts: 19
Joined: 23 Feb 2012, 18:13


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron