I am successfully able to connect to MySQL
and Postgres
database using 'sequel'
.
I want to connect to the SQL Server database from Ubuntu 12.04 to Windows machine. Using tiny-tds we can do that, but I want to use 'sequel' for connection
Gem Installed
gem 'dbi'
gem 'tiny_tds'
gem 'sequel'
gem "win32ole-pp"
gem "rubysl-win32ole"
gem 'activerecord-sqlserver-adapter'
I am getting following error.
1.9.3p448 :007 > require 'win32ole-pp'
LoadError: cannot load such file -- win32ole-pp
1.9.3p448 :008 > require 'rubysl-win32ole'
=> false
1.9.3p448 :001 > DB = Sequel.ado(:database => 'test_database', :host => 'xxx.xxx.xxx.xxx', :user => 'username', :password => 'password', :provider => 'SQLNCLI10')
Sequel::AdapterNotFound: LoadError: cannot load such file -- win32ole
Sequel provides adapter for tiny tds. How I can use that adapter? Please tell me how I can do that with sequel gem?
I am not getting how to use tiny tds with sequel, as sequel is providing adapter for tiny_tds.
Thank you...
Finally I am able to connect to remote MSSQL database from ubuntu 12.04 machine with help of sequel. Sequel uses tiny_tds for connecting to SQL server database. Here xxx.xxx.xxx.xxx is ip address of remote machine. No need for win32ole
Sequel provide adapter for MySQL2, Postgres, SQL Server and Tiny tds.
Gem Required
gem 'tiny_tds' #For SQlServer
gem 'mysql2' #For MySQL
gem 'sequel'
If you are connecting to MySQL2
DB = Sequel.connect(:adapter => 'mysql2', :user => 'username', :password => "passw0rd", :host => "xxx.xxx.xxx.xxx" , :database => "test_database")
If you are connecting to SQL Server
DB = Sequel.connect(:adapter => 'tinytds', :user => 'username', :password => "passw0rd", :host => "xxx.xxx.xxx.xxx" , :database => "test_database")
post = DB.from(:test_table)
post.all
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With