Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

DB console doesn't run for all Windows-based ruby implementations

#4470

On some implementations of ruby on Windows, DB console will not run because it will not be able to find the database client executable.

This is because DB console fails to recognise it is running on Windows, and therefore does not know to add ".exe" to the file executable file name.

The following code shows what happens in the current released version (2.3.5), and what happens when I modify the edge version to fix the problem, when running against RubyInstaller:

C:\Documents and Settings\agrimm\Desktop\code>irb
irb(main):001:0> puts RUBY_PLATFORM, RUBY_VERSION
i386-mingw32
1.9.1
=> nil irb(main):002:0> exit

C:\Documents and Settings\agrimm\Desktop\code>cd rails_2_3_5

C:\Documents and Settings\agrimm\Desktop\code\rails_2_3_5>ruby script\dbconsole
Couldn't find database client: sqlite3. Check your $PATH and try again.

C:\Documents and Settings\agrimm\Desktop\code\rails_2_3_5>cd ..\with_console_db_fixed

C:\Documents and Settings\agrimm\Desktop\code\with_console_db_fixed>rails dbconsole
SQLite version 3.6.23.1
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .exit

The code involved was like this in version 2.1.0

Reported by Andrew Grimm · April 25th, 2010 @ 11:07 AM

State: duplicate
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Andrew Grimm
    Andrew Grimm

    The following patch replaces an imperfect test for Windows using RUBY_PLATFORM with one that is more extensive and uses rbconfig's host_os value, as advocated by Proper way to detect Windows platform in Ruby.

    I haven't encountered any other cases of rbconfig being used this way in Rails.

    As the code that introduced this issue was written in 4a07103687084496b773e18a03b1f2f5e686f7ad (May 4, 2008), this fix may have to be applied to other branches as well.

    April 25th, 2010 @ 11:19 AM

  2. Andrew Grimm
    Andrew Grimm
    • Tag changed from dbconsole to bugs, dbconsole, patch

    I've just realized that this is a duplicate of #3999 Rails 2.3.5 on Windows: script/dbconsole cannot find sqlite3. I thought this was such an easily fixed bug that I didn't need to check whether it was reported before.

    April 25th, 2010 @ 12:32 PM

  3. Ryan Bigg
    Ryan Bigg
    • State changed from new to duplicate

    Duplicate of #3999 Rails 2.3.5 on Windows: script/dbconsole cannot find sqlite3. Please attach the patch there.

    April 26th, 2010 @ 05:34 AM