This project is archived and is in readonly mode.

dbconsole crashes if you have a numeric password
Reported by pfagiani (at gmail) | November 17th, 2008 @ 10:14 PM | in 2.x
if you are using MySQL and try to run script/dbconsole without the "-p" flag and you have a number [0-9] only password on database.yml then somehow it gets parsed as Fixnum and it will trigger an exception at line 44 of vendor/rails/railties/lib/commands/dbconsole.rb complaining that a number doesn't have the empty? method (NoMethodError).
The quick fix for that is to append .to_s in that to ensure that even it is a number it will get parsed ok. Here goes how i think it should be:
elsif config['password'] && !config['password'].to_s.empty?
instead of
elsif config['password'] && !config['password'].empty?
I've attached a git patch for fixing that.
Comments and changes to this ticket
- 
         Frederick Cheung December 18th, 2008 @ 11:17 AMEditing your database.yml so that it reads database_name: ... password: "1337"should do the trick 
- 
            
         Anderson Dias December 18th, 2008 @ 01:53 PMFrederick, I made this patch with pfagiani and we know we can use this alternative to solve the problem, but, I don't think that it's the better solution. :D The dbconsole should understand a non string password as other rails modules currently do. 
- 
         Frederick Cheung December 18th, 2008 @ 02:21 PMAh fine, was just suggesting a workaround if this was an immediate problem for people 
- 
            
         
- 
         Repository December 21st, 2008 @ 07:05 PM- State changed from new to resolved
 (from [7cda0df7f1511a10c515165dbce76e5c68b654ff]) Fix script/dbconsole not handling numeric password [#1395 state:resolved] Signed-off-by: Frederick Cheung frederick.cheung@gmail.com http://github.com/rails/rails/co... 
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 
         1395 
          dbconsole crashes if you have a numeric password
        (from [7cda0df7f1511a10c515165dbce76e5c68b654ff]) Fix
scr... 1395 
          dbconsole crashes if you have a numeric password
        (from [7cda0df7f1511a10c515165dbce76e5c68b654ff]) Fix
scr...
 Anderson Dias
      Anderson Dias