Hello all! I'm a newbie to Rails and I'm trying to get things working on an old RH9 box. I was wondering if someone could help me troubleshoot a mysql_adapter.rb error? I set everything up and created a simple test app and then generated a scaffold for it. When I try to go to the main controller and list the data, I get the following error: ArgumentError... NULL pointer given The stack trace starts in my controller where it is trying to return the values for the "list" action (simply read the records in the DB), but the actual error appears to be in mysql_adapter.rb:326 as part of the private "select" method. I don't know if the problem is in this adapter or has to do with my configuration. Is there a way to set debug statements in code that's not part of your app? I'd like to see what the "sql" variable is in the "select" method of mysql_adapter.rb to try and see what's going on. Lessee... I am using MySQL 4.1 with a user account without a password. I'm running the latest stable ruby and rails packages (installed today). I've tried both webrick and lighttpd and neither matters. I also had this error when I had MySQL 4.0 installed earlier today (I upgraded as part of my attempts to figure this out). As near as I can tell, everything else is working. The irony is that the default controller when the DB table is empty works and shows the form... and lets me insert. So INSERT commands are working, but then the view to show the list chokes. Why would INSERT work but not SELECT?? Hrm. Anyway, I'd love any help with this... even as simple as how to debug the Ruby code in mysql_adapter.rb to determine what values are getting passed in/out. BTW, I don't know if there is a better place to post these questions. I've been banging my head against this all day. If it would be better to contact me directly instead of via the list, please do so. :-) firstname.lastname@example.org Thanks! -Dan
on 2006-03-14 00:19
on 2006-03-14 12:13
Hello, Try 'gem install mysql' For installing base ruby adapter dependency.
on 2006-03-14 20:37
Mathieu C. wrote: > Hello, > > Try 'gem install mysql' > > For installing base ruby adapter dependency. Mathieu, Thanks. I tried this but it didn't make any difference. The mysql adapter is already there and installed (as I said, INSERT calls go through). In trying to narrow this down, I've set up Rails & MySQL on my windoze box as well. I then did a super-simple test case on both windows and linux. The windows version worked fine, the linux version crashed with the same null pointer error. I then tried to run the windows version (i.e code & server on windows) but connecting to the linux database (via TCP/IP sockets). That worked fine. I then tried to run the linux version (i.e. code & server on linux) but connecting to the linux database via TCP/IP instead of mysql.sock. That crashed (same null pointer error). I couldn't get it to work where the code & server on linux connects to the windows database (some mysql connection issue... probably a misconfiguration or something). So it seems that I've narrowed it down to most likely a mysql.sock error. I wish I knew how to further troubleshoot it. But at least I can get back into Rails development (yippee!) Anyway... I imagine a clean install of mysql might help, but I've got lots of legacy databases that I'd hate to lose. Hrm. So if anyone has any other thoughts or suggestions, I'd be open to them. :-) Thanks! -Dan