Forum: Ruby on Rails Unable to connect to ms sql server.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Aa6145211ae5b044a27c0707e5d1f525?d=identicon&s=25 Avinash (Guest)
on 2006-06-03 07:45
I get the following error message when trying to connect to ms sql
server:

Open
    OLE error code:80040E4D in Microsoft OLE DB Provider for SQL Server
      Login failed for user 'XXXXXXXX'.
    HRESULT error code:0x80020009
      Exception occurred.


I google'd for those error codes but nothing useful so far. To set up
ruby for ms sql server, I followed the instructions here:


http://wiki.rubyonrails.com/rails/pages/HowtoConne...


I followed the first 2 steps (copying ado.rb and modifying
database.yml) but I cannot get it to connect to the sql server.

Ofcourse, I have verified that the credentials are good since I am able
to connect to the server from other interfaces.

Also, is there a way to force ruby to use windows authentication for
connecting to sql servers?

Any tips, thoughts?
thanks in advance,
--
avinash
2ea2840648beec7d5510cdeebd3a9a66?d=identicon&s=25 Shashank Date (Guest)
on 2006-06-04 08:57
(Received via mailing list)
Hi Avinash,

  Can you please tell me, what you see when you run the following script
(assuming SQL Server 2K on Win XP):

  #----------------------------------
  require 'active_record'

  ActiveRecord::Base.establish_connection(
  :adapter => "sqlserver",
  :host => "DBI:ADO:Provider=SQLOLEDB;Data Source=(local);Initial
Catalog=master;Integrated Security=SSPI",
  :database => "master"
)

class Sysobject < ActiveRecord::Base
end

  tables = Sysobject.find_by_sql("select name from sysobjects where
xtype = 'U'   ")
tables.each{|t| puts t.name}
  #--------------------------------------

  I get to see all the names of user defined tables on my setup.

  Once we get past this point on your setup, making it work in Rails is
left as an exercise :-)

  HTH,

  -- Shashank

Avinash <avinash404@gmail.com> wrote:
  I get the following error message when trying to connect to ms sql
server:


 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
This topic is locked and can not be replied to.