I am trying to use tiny tds and sqlserver adapter on a shared mssql
database. I'm using octopus to manage the sharding
The problem I am having is this :
ruby-1.9.2-p180 :009 > Octopus.using(:pg2){Comment.first}
ActiveRecord::StatementInvalid: TinyTds::Error: Incorrect syntax near
'1'.: SELECT [ISBizBlogger_Comment].* FROM [ISBizBlogger_Comment]
LIMIT 1
shards.yml:
octopus:
environments:
- test
- development
- qa
qa:
portal_groups:
pg2:
dataserver: qahost
username: qausername
password: qapassword
mode: dblib
port: 1433
development:
portal_groups:
pg1:
host: localhost
adapter: mysql2
database: judge_dev_shard_1
username: root
password: root
pg2:
host: localhost
adapter: mysql2
database: judge_dev_shard_2
username: root
password: root
test:
portal_groups:
pg1:
host: localhost
adapter: mysql2
database: judge_test_shard_1
username: root
password: root
pg2:
host: localhost
adapter: mysql2
database: judge_test_shard_2
username: root
password: root
config/database.yml
development:
adapter: mysql2
host: localhost
database: judge_development
username: root
password: root
pool: 5
timeout: 5000
qa:
host:
qa.reference.com
username: username
password: password
adapter: mysql2
database: QA
pool: 5
timeout: 5000
test:
adapter: mysql2
host: localhost
database: judge_test
username: root
password: root
pool: 5
timeout: 5000
/etc/freetds/freetds.conf
[global]
tds version = 8.0
connect timeout = 10
text size = 64512
port = 1433
# dump file = /tmp/freetds.log
# debug flags = 0xffff
# timeout = 10
[qahost]
host = qahost
Gemfile
source '
http://rubygems.org'
gem 'rails', '3.0.5'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://
github.com/rails/rails.git'
gem 'sqlite3'
gem "mysql2"
gem "ar-octopus", :require => "octopus", :git => "
https://github.com/
tchandy/octopus.git"
gem "haml"
group :qa do
gem "tiny_tds"
gem "activerecord-sqlserver-adapter", :require => false
end
app/models/comment.rb
class Comment < ActiveRecord::Base
octopus_set_table_name "ISBizBlogger_Comment"
end