Re: ActiveRecord connect to SqlServer



On Jan 24, 10:34 am, Todd Benson <caduce...@xxxxxxxxx> wrote:
On Jan 24, 2008 9:59 AM, dkmd_nielsen <d...@xxxxxxxxxx> wrote:

I know you guys have beaten this subject to death, but I'm just not
getting a connection to SqlServer 2005.  It is installed locally, with
an instance name of DVN-P548.  I use my windows user name and password
to log in.

require 'rubygems'
require_gem 'activerecord'

ActiveRecord::Base.establish_connection(
        :adapter => 'sqlserver',
        :mode => 'ADO',
        :host => 'P548-DVN',

Why is this not DVN-P548?

        :dsn => '???',                             ** what is this supposed
to be???

You shouldn't need that part of the Hash.  Try leaving the :dsn part out..

        :database => 'CountsAAN',
        :username => 'my_windows_userid',
        :password => 'my_password'
)

class WiRecord < ActiveRecord::Base
end

Errors I get returned are either "Server does not exist or access is
denied" (thanks, MS, for narrowing this one down a bit), or "user is
not trusted"

That last error is a bit weird.  That means you're connecting to
something, but failing.  Maybe look at your permissions?

, depending on what values I have attempted for host and
dsn.  What is host and dsn?  Believe it or not, I do not find a clear
definition in the rails handbook.

"host" is the name of the machine you are running the database on.
This can also be an IP address.  If the database is on the same
machine, use 127.0.0.1 or localhost.



Do I want to use ADO, or should I use ODBC?  If odbc, where does one
find the connection string?  Being a windows user, I'm so used to
having everything done for me under the covers that I don't understand
any of the underlying details.

Hopefully somebody else can answer this.

Thanks for everything,
dvn

Todd

I think this error "Server does not exist or access is
denied" (thanks, MS, for narrowing this one down a bit), or "user is
not trusted" means you are trying to access a sql server that is
domain authenticated by supplying a sql server authenticated user

Also, when I used ado some time back with rails I got lots of errors,
but switching to odbc mae it work fine.

Paul
.



Relevant Pages

  • Re: DSN-less Connections
    ... System DSN to create their own Access front end and connect to the tables in SQL Server. ... I don't know this for a fact but I would expect that it pass some kind of a token or hash to identify a computer/user to the SQL Server. ... There's just a key for "Use Trusted Connection" and LastUser. ... However, for a DSN for other data sources, the password is stored there plaintext. ...
    (microsoft.public.access.modulesdaovba)
  • Re: connecting to sql server from asp page
    ... In your DSN, if you include the login and password, then you are specifying ... Connectivity client application are always ignored by SQL Server ... You have two choices - either supply the uid and pwd in the connection open ... to used both Windows and Sql Server authentication. ...
    (microsoft.public.sqlserver.connect)
  • Re: ActiveRecord connect to SqlServer
    ... getting a connection to SqlServer 2005. ... I use my windows user name and password ... Try leaving the:dsn part out. ... "host" is the name of the machine you are running the database on. ...
    (comp.lang.ruby)
  • Re: ActiveRecord connect to SqlServer
    ... getting a connection to SqlServer 2005. ... I use my windows user name and password ... Try leaving the:dsn part out. ... Do I want to use ADO, or should I use ODBC? ...
    (comp.lang.ruby)
  • Re: ActiveRecord connect to SqlServer
    ... getting a connection to SqlServer 2005. ... I use my windows user name and password ... What is host and dsn? ... I setup the ODBC connection and it is working ...
    (comp.lang.ruby)