I’m trying to connect to a SQLServer 2008 database running on localhost,
but I can’t seem to get it working.
Every time I try to run rake db:migrate I get an error telling me that I
should install activerecord-sqlserver-adapter:
I have tried to installe ther server-adapter with gem, but it doesn’t
seems to be working properly.
$ rake db:migrate
(in c:/Documents and Settings/mad/My Documents/Aptana Studio 3
Workspace/Musix)
rake aborted!
Please install the sqlserver adapter: gem install activerecord-sqlserver-adapter
(no such file to load –
active_record/connection_adapters/sqlserver_adapter)
(See full trace by running task with --trace)
$ gem install activerecord-sqlserver-adapter
Successfully installed activerecord-sqlserver-adapter-3.0.5
1 gem installed
Installing ri documentation for activerecord-sqlserver-adapter-3.0.5…
Installing RDoc documentation for
activerecord-sqlserver-adapter-3.0.5…
$ rake db:migrate
(in c:/Documents and Settings/mad/My Documents/Aptana Studio 3
Workspace/Musix)
rake aborted!
Please install the sqlserver adapter: gem install activerecord-sqlserver-adapter
(no such file to load –
active_record/connection_adapters/sqlserver_adapter)
(See full trace by running task with --trace)
I struggled with getting SQLServer to work with rails a couple years
ago. I can’t speak to how easy or hard it is to do recently (sounds
just as painful), but here are the steps for how I did it then…they
might help. A note about step 2, at the time I used v0.1.0 of ruby-
dbi. ADO.rb continued to be included up through v0.2.2 and ADO.rb
from that version should still work but I think they stopped
supporting ADO after that. I know these steps work with SQLServer
2005, I’m curious to know if this also works with 2008. Also, I seem
to remember this only working with Ruby 1.8.6. I have since switched
database systems and haven’t been motivated enough to figure out
SQLServer with newer code.
- Install SqlServer adapter gem activerecord-sqlserver-adapter
(Only works with v1.0.0)
- Download source distribution of Ruby-DBI from rubyforge.org/
projects/ruby-dbi/ (at the time, I used v0.1.0.
-copy the file lib/dbd/ADO.rb to Ruby/lib/ruby/site_ruby/1.8/DBD/ADO/
ADO.rb
database.yml file format:
development:
adapter: sqlserver
database: database_name
host: server_name
username: user_name
password: password
Hope this helps,
Bob
hi Bob,
Go through this url this will be helpful for you.
On Tue, Nov 2, 2010 at 8:40 PM, Bob [email protected] wrote:
SQLServer with newer code.
adapter: sqlserver
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected][email protected]
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
–
Thanks & Regards,
MuraliDharaRao.T
+91-9642234646
Magnus D. wrote in post #958686:
I’m trying to connect to a SQLServer 2008 database running on localhost,
but I can’t seem to get it working.
Advice: do not use MS SQL Server with Rails. Do not do Rails
development on Windows. Both of these will make your life harder.
Every time I try to run rake db:migrate I get an error telling me that I
should install activerecord-sqlserver-adapter:
[…]
What does your database.yml file look like?
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
Marnen Laibow-Koser wrote in post #958814:
Magnus D. wrote in post #958686:
I’m trying to connect to a SQLServer 2008 database running on localhost,
but I can’t seem to get it working.
Advice: do not use MS SQL Server with Rails. Do not do Rails
development on Windows. Both of these will make your life harder.
I’m starting to learn this. ![:slight_smile: :slight_smile:](/images/emoji/apple/slight_smile.png?v=6)
What does your database.yml file look like?
development:
adapter: sqlserver
mode: odbc
dsn: dsn_name
database: database_name
I have a user dsn connected to the database.
Thanks
Magnus
Marnen Laibow-Koser wrote in post #959078:
Magnus D. wrote in post #958933:
Marnen Laibow-Koser wrote in post #958814:
Magnus D. wrote in post #958686:
I’m trying to connect to a SQLServer 2008 database running on localhost,
but I can’t seem to get it working.
Advice: do not use MS SQL Server with Rails. Do not do Rails
development on Windows. Both of these will make your life harder.
I’m starting to learn this. ![:slight_smile: :slight_smile:](/images/emoji/apple/slight_smile.png?v=6)
What does your database.yml file look like?
development:
adapter: sqlserver
mode: odbc
dsn: dsn_name
database: database_name
I have a user dsn connected to the database.
You neglected to specify user and password.
I have tried both with an User DSN and a File DSN, and the User DSN used
the login on the system.
Also, you’re using ODBC. I would recommend instead installing TinyTds
and using mode: dblib. This allows Rails to make a direct TDS
connection to your DB and bypass ODBC entirely.
Can I use TinyTds on a Windowsbox? I thought it was Linux-only.
Magnus
On Nov 2, 7:38am, “Magnus D.” [email protected] wrote:
I’m trying to connect to a SQLServer 2008 database running on localhost,
but I can’t seem to get it working.
Hi Magnus,
I am using MSSQL and like you I had lots of trouble making it work but
I finally did get it to work. I am also using XP and here is my Ruby
and Rails environment:
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
Rails 2.3.5
Here is a list of the steps I took from beginning to end. You might
need to change/skip some of the steps. I hope it helps:
- Install Ruby (1.8.6): Download Ruby
- Install rubygems:
a. Download RubyGems | RubyGems.org | your community gem host (zip version)
b. Unpack to a directory and cd there
c. ruby setup.rb
- Install rails: gem install rails v=2.3.5
- Install mongrel: gem install mongrel
- Install mongrel service: gem install mongrel_service
- Install SQL Server adapter: gem install activerecord-sqlserver-
adapter
- Install ODBC gem: gem install odbc-rails
- Install SQL Server Management utility (from Microsoft)
- Create SQL Server DB (name ‘give it a name here’)
- Create login in SQL Server (‘give it a name here’)
- Create DB user (‘give it a name here’)
- Create DSN in Windows:
a. Control Panel → Adminstrative Tasks → Data Sources (ODBC)
b. Click on System DSN → Add
c. Select type SQL Server
i. Name: ‘give it a name here’
ii. Description: ‘give it a name here’
iii. Server: Server name (i.e.: ‘Whatever name the DB has under
SQL Server Manangement here’)
iv. Use SQL Authentication
Magnus D. wrote in post #958933:
Marnen Laibow-Koser wrote in post #958814:
Magnus D. wrote in post #958686:
I’m trying to connect to a SQLServer 2008 database running on localhost,
but I can’t seem to get it working.
Advice: do not use MS SQL Server with Rails. Do not do Rails
development on Windows. Both of these will make your life harder.
I’m starting to learn this. ![:slight_smile: :slight_smile:](https://www.ruby-forum.com/images/emoji/apple/slight_smile.png?v=12)
What does your database.yml file look like?
development:
adapter: sqlserver
mode: odbc
dsn: dsn_name
database: database_name
I have a user dsn connected to the database.
You neglected to specify user and password.
Also, you’re using ODBC. I would recommend instead installing TinyTds
and using mode: dblib. This allows Rails to make a direct TDS
connection to your DB and bypass ODBC entirely.
Thanks
Magnus
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
Sent from my iPhone
pepe wrote in post #959313:
On Nov 2, 7:38am, “Magnus D.” [email protected] wrote:
I’m trying to connect to a SQLServer 2008 database running on localhost,
but I can’t seem to get it working.
Hi Magnus,
I am using MSSQL and like you I had lots of trouble making it work but
I finally did get it to work. I am also using XP and here is my Ruby
and Rails environment:
Thanks.
I’m now trying to reinstall ruby on my computer, and if that doesn’t
work, I’m thinking about throwing it out the window.
Magnus
On 5 November 2010 13:34, Magnus D. [email protected] wrote:
Thanks.
I’m now trying to reinstall ruby on my computer, and if that doesn’t
work, I’m thinking about throwing it out the window.
You might be better to throw Windows out of your computer rather than
the computer out of the window.
Colin
On Nov 3, 10:27am, “Magnus D.” [email protected] wrote:
Marnen Laibow-Koser wrote in post #958814:> Magnus D. wrote in post #958686:
Advice: do not use MS SQL Server with Rails. Do not do Rails
development on Windows. Both of these will make your life harder.
I’m starting to learn this. ![:slight_smile: :slight_smile:](https://www.ruby-forum.com/images/emoji/apple/slight_smile.png?v=12)
A bit OT, but seeing as you mentioned it, as a Windows user that has
recently migrated my Rails apps to a Linux box, I can confirm what I
have frequently read on this group: Rails and Linux > Rails and
Windows.
I was brand new to Linux, and got everything up and running in no time
compared with my original struggles on Windows, and it looks like a
far better OS. If you haven’t yet made the jump, I would recommend it.
Best
Paul
(Linux convert)
I’m now trying to reinstall ruby on my computer, and if that doesn’t
work, I’m thinking about throwing it out the window.
Magnus
In a few months I would like to be where Paul is at and pretty much
every day of my life I feel like doing what Colin is suggesting. ![:wink: :wink:](/images/emoji/apple/wink.png?v=6)
pepe