Okay. I'd like to patch this, but I'm gonna need a little bit of help. Here's what looks relevant:
MYSQL_DATABASE_DISCONNECT_ERRORS = /\A(Commands out of sync; you can't run this command now|Can't connect to local MySQL server through socket|MySQL server has gone away)/ raise_error(e, :disconnect=>true) if MYSQL_DATABASE_DISCONNECT_ERRORS.match(e.message) I presume that that passing :disconnect=>true will execute disconnect_connection. **************************************** So I'd need to create something like this: ODBC_DATABASE_DISCONNECT_ERRORS = /\A(08S01)/ raise_error(e, :disconnect=>true) if ODBC_DATABASE_DISCONNECT_ERRORS.match(e.message) On May 4, 10:35 am, Jeremy Evans <[email protected]> wrote: > On May 4, 9:26 am, cult hero <[email protected]> wrote: > > > I have a web app that connects to an MSSQL DB (2005 I believe). The > > provider of this database is, for lack of a better work, kind of > > flaky. Every couple days the connection will just crap out and > > anything that tries to use the models from this database will barf up > > the following error: > > > Exception raised: Sequel::DatabaseError > > Message: ODBC::Error: 08S01 (0) [unixODBC][FreeTDS][SQL > > Server]Communication link failure > > > Aside from simply redefining the constant DB_MSSQL (presuming that > > would work) is there some kind of method to reconnect? > > > Right now I restart the application, but I'd prefer to have the > > application fix itself when that error is raised. > > The Sequel ODBC adapter does not use DatabaseDisconnectError to signal > that the connection was disconnected. If added, it would signal the > connection pool to drop the connection, so the next request would get > a new connection. So I would look into adding support for that to the > ODBC adapter. Hopefully that 08S01 error always indicates > disconnection, in which case it should be possible to handle with a > regular expression. See the MySQL adapter for an example of how to > handle it. > > Jeremy > > -- > You received this message because you are subscribed to the Google Groups > "sequel-talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/sequel-talk?hl=en. -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
