title: how to switch off Ruby on Rails MySQL2 session query
body: <p>I am trying to connect Ruby on Rails application to dbShards database. Their database switched off session variable to optimise shard performance. Hence when I tried to run the application, i get this error:</p>
  
  <pre><code>2014-11-17 08:23:29,647 ERROR c.d.s.SQLParser [NioServer-WorkerPool-2] Failed to parse SET NAMES utf8,  @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 21
  47483, @@SESSION.sql_mode = 'STRICT_ALL_TABLES'
   java.sql.SQLException: Session variables are not shard-safe
          at com.dbshards.sqlparsernew.SQLParser.parseSet(SQLParser.java:558)
          at com.dbshards.sqlparsernew.SQLParser.parse(SQLParser.java:402)
          at com.dbshards.sqlparsernew.SQLParserCache.parse(SQLParserCache.java:79)
          at com.dbshards.jdbc.sharding.DbsShardedStatement.execute(DbsShardedStatement.java:388)
          at com.dbshards.osp.client.impl.processor.JDBCProcessor.execute(JDBCProcessor.java:321)
          at com.dbshards.osp.client.impl.myosp.MyOSPProtocolHandler.processQueryRequest(MyOSPProtocolHandler.java:876)
          at com.dbshards.osp.client.impl.myosp.MyOSPProtocolHandler.doProcessBuffer(MyOSPProtocolHandler.java:518)
          at com.dbshards.osp.client.impl.myosp.MyOSPProtocolHandler.processBuffer(MyOSPProtocolHandler.java:1520)
          at com.codefutures.common.messaging.transport.nio.NioConnection.doRead(NioConnection.java:127)
          at com.codefutures.common.messaging.transport.nio.NioServer.doProcessRequests(NioServer.java:556)
          at com.codefutures.common.messaging.transport.nio.NioServer.access$200(NioServer.java:25)
          at com.codefutures.common.messaging.transport.nio.NioServer$2.run(NioServer.java:534)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>even when i set strict: false in database.yml, this is what i get:</p>
  
  <pre><code>2014-11-17 12:11:11,229 ERROR c.d.s.SQLParser [NioServer-WorkerPool-12] Failed to parse SET NAMES utf8,  @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 21
  47483, @@SESSION.sql_mode = ''
   java.sql.SQLException: Session variables are not shard-safe
          at com.dbshards.sqlparsernew.SQLParser.parseSet(SQLParser.java:558)
          at com.dbshards.sqlparsernew.SQLParser.parse(SQLParser.java:402)
          at com.dbshards.sqlparsernew.SQLParserCache.parse(SQLParserCache.java:79)
          at com.dbshards.jdbc.sharding.DbsShardedStatement.execute(DbsShardedStatement.java:388)
          at com.dbshards.osp.client.impl.processor.JDBCProcessor.execute(JDBCProcessor.java:321)
          at com.dbshards.osp.client.impl.myosp.MyOSPProtocolHandler.processQueryRequest(MyOSPProtocolHandler.java:876)
          at com.dbshards.osp.client.impl.myosp.MyOSPProtocolHandler.doProcessBuffer(MyOSPProtocolHandler.java:518)
          at com.dbshards.osp.client.impl.myosp.MyOSPProtocolHandler.processBuffer(MyOSPProtocolHandler.java:1520)
          at com.codefutures.common.messaging.transport.nio.NioConnection.doRead(NioConnection.java:127)
          at com.codefutures.common.messaging.transport.nio.NioServer.doProcessRequests(NioServer.java:556)
          at com.codefutures.common.messaging.transport.nio.NioServer.access$200(NioServer.java:25)
          at com.codefutures.common.messaging.transport.nio.NioServer$2.run(NioServer.java:534)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>Is there a way in Ruby On Rails to totally turn off session variables since dbshards.com products reject them?</p>