database.yml in Rails reconnect set to true or false -


in database.yml, default settings reconnect on rails 3 , 4 false. common setting, , in circumstances should set true? thanks.

you can set true. option introduced in rails 2.3

mysql supports reconnect flag in connections - if set true, client try reconnecting server before giving in case of lost connection. can set reconnect = true mysql connections in database.yml behavior rails application.

rails team set option default 'false' because, don't want change behavior of existing applications.

but side effects there if set reconnect = true. not transaction-safe.the mysql documentation in fact explicitly states auto-reconnect feature affects transactions.

any active transactions rolled , autocommit mode reset.

applications not written deal break. documentation lists number of other side effects caused auto-reconnect feature, of cause applications not written anticipate behavior function incorrectly or fail.

check:

rails 2.3 release notes

mysql-reconnect-value-doesnt-stick

see stackoverflow qn


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -