My app's Ruby workers connect to my Rails app database via MYSQL, using the mysql2 gem. I have two workers: 1 on the same server with the app, 1 remote. When the following UPDATE
and SELECT
queries run on the remote server, they do not update/select the data.
variablename = true
othervariable = false
client = Mysql2::Client.new(:host => @app_ip_address, :username => @mysql_username, :password => @mysql_password)
client.query("USE `publisher_support_automation_app`;")
update_query = %{ UPDATE tablename SET
variablename = #{variable1},
othervariable = #{variable2},
WHERE id = #{@id};
}.gsub(/\s+/, ' ')
client.query(update_query) #=> no error, data not updated
res = client.query("SELECT * FROM tablename WHERE id = #{@id};")
res.each do |row|
@logger.debug(row.inspect) #=> nothing logged
end
client.close
However, other UPDATE
, SELECT
(and INSERT
) commands work fine. When I run the exact commands in IRB, they work fine.
I turned on MYSQL error logging per this post, and no errors are logged.
The remote machine is using Ruby version 2.1.1p76, MYSQL Server version 5.1.73 and mysql2 version 0.4.1. The app is using Ruby version 2.0.0p353, MYSQL Server version: 5.1.73 and mysql2 version 0.3.18.