Unable to connect to ms sql server

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/HowtoConnectToMicrosoftSQLServer

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

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 :slight_smile:

HTH,

– Shashank

Avinash [email protected] 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