Thanks for all that detail Caspar - really appreciated!

I'll try to find some time to work through this, but life's pretty crazy at the 
moment, can't promise it'll happen soon. May the Easter weekend I'll have a bit 
of time :)

-- 
Pat

On 12/03/2010, at 9:02 AM, Casper wrote:

> 
> Thanks Pat. An ODBC connection only needs to know the username and
> password, and possibly the database name, but even that is not really
> required. So username and password are the minimal requirements.
> 
> The idea how this works is the user normally configures the connection
> parameters in /etc/odbc.ini (when using UnixODBC on Linux for
> example), and then the ActiveRecord ODBC adapter simply connects to a
> named record in odbc.ini with the given username and password (the
> same procedure should happen on Windows machines too). As an example I
> have this in my odbc.ini:
> 
> [virtualbox]
> Driver          = FreeTDS
> Description     = ODBC conection to VirtualBox WinXP running SQL
> Server
> Trace           = No
> Servername      = virtualbox
> Database        = myproject_development
> 
> The name of this connection is [virtualbox]. In my database.yml I then
> have:
> 
> development:
>  adapter:  sqlserver
>  mode:     ODBC
>  dsn:      virtualbox
>  username: something
>  password: secret
> 
> So the adapter part loads http://github.com/rails-sqlserver/2000-2005-adapter
> (if you have it installed..this is the one to use out of all the
> various versions out there), the adapter then uses the Ruby ODBC
> library and tells it to connect to a source named "virtualbox" (from
> the 'dsn' part)..with the user/pass provided.
> 
> If I then, after connecting, do:
> irb>
> ActiveRecord::Base.connection.instance_variable_get(:@connection_options)
> 
> I get:
> => ["DBI:ODBC:virtualbox", "something", "secret"]
> 
> And of course:
> irb> ActiveRecord::Base.connection.class
> => ActiveRecord::ConnectionAdapters::SQLServerAdapter
> 
> Not sure if this helps..I hope it does, as it took me a while to
> figure out the whole logic behind how the ODBC stuff actually works.
> 
> In fact there's one more component that comes AFTER the ODBC
> adapter..and that's the driver (FreeTDS) which actually says WHERE (ip
> address) the database is and how to connect to it, but that part is
> not visible to Rails nor Ruby in any way..so I left it out of the
> explanation. But the whole route is database.yml -> ActiveRecord ->
> SQLServerAdapter -> Ruby ODBC -> UnixODBC (odbc.ini) -> FreeTDS ->
> target database (Windows XP running SQL Server).
> 
> Casper
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/thinking-sphinx?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to