is there any way to find out the server from an ActiveRecord connection?

I'm using AR with SQLServer adapter on Rails2/linux. On my local env, I can easily change freetds and odbc.ini files to trace back and find out the connection information. But in test envs, this information constantly changes and gets out of sync, so I'm trying to put it in our logging as well so we can troubleshoot more easily.

Yes, I know TinyTDS does this better, we are moving to that, but not quite there yet.

I can do:

ActiveRecord::Base.connection.current_database

But can't find anything similar for getting the server address or ip.

-------------Problems Reply------------

i can't remember if there is a public API for this, but you can get the config of AR like this

ActiveRecord::Base.connection.instance_variable_get '@config'

this returns the config hash, which includes the host

Category:ruby on rails Views:0 Time:2012-03-07

Related post

  • What is unit testing? 2008-08-04

    I saw many questions asking 'how' to unit test in a specific language, but no question asking 'what', 'why', and 'when'. What is it? What does it do for me? Why should I use it? When should I use it (also when not)? What are some common pitfalls and

  • Using a DOS command in Ruby script 2008-08-05

    How do I call shell commands from inside of a Ruby program? How do I then get output from these commands back into Ruby? --------------Solutions------------- This explanation is based on this commented Ruby script from a friend of mine. If you want t

  • DISCUSSION - Uploading and Storing Mass Images 2008-08-06

    So I'm using an app that stores images heavily in the DB. What's your outlook on this? I'm more of a type to store the location in the filesystem, than store it directly in the DB. What do you think are the pros/cons? --------------Solutions---------

  • storing files to a database or just to the local hard-disk? 2008-08-06

    So I'm using an app that stores images heavily in the DB. What's your outlook on this? I'm more of a type to store the location in the filesystem, than store it directly in the DB. What do you think are the pros/cons? --------------Solutions---------

  • Where is a good place to start programming GUIs for windows? 2008-08-07

    I have experience writing console and network client/server applications in C and C++, but I know next to nothing about using the win32 visual API, MFC, Qt, wxWidgets, etc. Where is a good place to start, and what method should I specialize in, so as

  • How to include PHP files that require an absolute path? 2008-08-07

    I have a directory structure like the following; /script.php /inc/include1.php /inc/include2.php /objects/object1.php /objects/object2.php /soap/soap.php Now, I use those objects in both script.php and /soap/soap.php, I could move them, but I want th

  • How do I retrieve my MySQL username and password? 2008-08-07

    I lost my MySQL username and password. How do I retrieve it? --------------Solutions------------- Stop the MySQL process. Start the MySQL process with the --skip-grant-tables option. Start the MySQL console client with the -u root option. List all th

  • Best Debugging Tools for JavaScript/xulrunner Development 2008-08-07

    In the past few months I began my first serious JavaScript development, as I began developing XUL applications. I use Notepad++ as my editor, but I was pretty appalled to find (as far as I can tell) that Venkman/Javascript Debugger is the tool for de

  • Drop all tables whose names begin with a certain string 2008-08-07

    I'd like a script to drop all tables whose name begins with a given string. I'm sure this can be done with some dynamic sql and the INFORMATION_SCHEMA tables. If anyone has a script, or can knock one up quickly, please post it. If no-one posts an ans

  • How do I update Ruby Gems from behind a Proxy (ISA-NTLM) 2008-08-07

    Firewall I'm behind is running Microsoft ISA server (NTLM only mode), anyone have success getting their Ruby gems to install/update via Ruby SSPI gem or other method? ... or am I just being lazy? Edit: rubysspi-1.2.4 does not work UPDATE: This also w

  • ruby script/plugin discover RuntimeError 2008-08-07

    Firewall I'm behind is running Microsoft ISA server (NTLM only mode), anyone have success getting their Ruby gems to install/update via Ruby SSPI gem or other method? ... or am I just being lazy? Edit: rubysspi-1.2.4 does not work UPDATE: This also w

  • How to easily consume a web service from PHP 2008-08-07

    Is there available any tool for PHP which can be used to generate code for consuming a web service based on its WSDL? Something comparable to clicking "Add Web Reference" in Visual Studio or the Eclipse plugin which does the same thing for Java. ----

  • Vista or XP for Dev Machine 2008-08-07

    I am about to get a new PC from work, and it will include the option to have either Vista Business as the OS, or a downgrade to XP Pro. Aside from a tiny bit of testing, I have never used Vista, but overall I have heard many more bad reports than goo

  • How to know when to send a 304 Not Modified response 2008-08-07

    I'm writing a resource handling method where I control access to various files, and I'd like to be able to make use of the browser's cache. My question is two-fold: Which are the definitive HTTP headers that I need to check in order to know for sure

  • Is there any trick that allows to use Management Studio's (ver. 2008) IntelliSense feature with earlier versions of SQL Server? 2008-08-07

    New version of Management Studio (i.e. the one that ships with SQL Server 2008) finally has a Transact-SQL IntelliSense feature. However, out-of-the-box it only works with SQL Server 2008 instances. Is there some workaround for this? --------------So

  • Using Xming X Window Server over a VPN 2008-08-07

    I have the Xming X Window Server installed on a laptop running Windows XP to connect to some UNIX development servers. It works fine when I connect directly to the company network in the office. However, it does not work when I connect to the network

  • SQL Server 2005 and 2008 on same developer machine? 2008-08-07

    Has anyone tried installing SQL Server 2008 Developer on a machine that already has 2005 Developer installed? I am unsure if I should do this, and I need to keep 2005 on this machine for the foreseeable future in order to test our application easily.

  • HTTP: Generating ETag Header 2008-08-07

    How do I generate an ETag HTTP header for a resource file? --------------Solutions------------- An etag is an arbitrary string that the server sends to the client that the client will send back to the server the next time the file is requested. The e

  • Simple MOLAP solution 2008-08-07

    To analyze lots of text logs I did some hackery that looks like this Locally import logs into Access Reprocess Cube link to previous mdb in Analisis Service 2000 (yes it is 2k) Use Excel to visualize Cube (it is not big - up to milions raw entries) M

  • Http Auth in a Firefox 3 bookmarklet 2008-08-07

    Im trying to create a bookmarklet for posting del.icio.us bookmarks to a seperate account. I tested it from the command line like: wget -O - --no-check-certificate \ "https://seconduser:[email protected]/v1/posts/add?url=http://seet.dk&

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.080 (s). 11 q(s)