This project is archived and is in readonly mode.

#4470 ✓duplicate
Andrew Grimm

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

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

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
=> 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
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .exit

The code involved was like this in version 2.1.0

Comments and changes to this ticket

  • Andrew Grimm

    Andrew Grimm April 25th, 2010 @ 11:19 AM

    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.

  • Andrew Grimm

    Andrew Grimm April 25th, 2010 @ 12:32 PM

    • Tag changed from dbconsole to bugs, dbconsole, patch

    I've just realized that this is a duplicate of #3999. I thought this was such an easily fixed bug that I didn't need to check whether it was reported before.

  • Ryan Bigg

    Ryan Bigg April 26th, 2010 @ 05:34 AM

    • State changed from “new” to “duplicate”

    Duplicate of #3999. Please attach the patch there.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket


Referenced by