Skip to content

Commit 17210c3

Browse files
committed
[mysql] support for config[:reconnect] (might need some fine tuning to match mysql2)
1 parent 6315e4c commit 17210c3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/arjdbc/mysql/connection_methods.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ def mysql_connection(config)
3131
properties['useUnicode'] = 'true' unless properties.key?('useUnicode') # otherwise platform default
3232
encoding = config.key?(:encoding) ? config[:encoding] : 'utf8'
3333
properties['characterEncoding'] = encoding if encoding
34+
if ! ( reconnect = config[:reconnect] ).nil?
35+
properties['autoReconnect'] ||= reconnect.to_s
36+
# properties['maxReconnects'] ||= '3'
37+
# with reconnect fail-over sets connection read-only (by default)
38+
# properties['failOverReadOnly'] ||= 'false'
39+
end
3440

3541
jdbc_connection(config)
3642
end

0 commit comments

Comments
 (0)