views:

1088

answers:

2

I have a new rails application which I have created under Windows 7 by going into a directory and typing "rails newapp". The creation went fine, and when I access the root page, all is well. However, when I try to access a page that would access the database, I get this:

193: %1 is not a valid Win32 application.

In the developer.log. Mysql is running fine on my machine, and I have other applications which I have running in here in other directories, it's just this one that doesn't work. Any thoughts?

+6  A: 

Here's the answer that worked for me. Turns out it was an issue of x64 vs. x32 issue and Rails 2.3.2.

The answer I got from here (http://osdir.com/ml/RubyonRailsTalk/2009-06/msg01775.html):

In case anyone else has the same problem after a lot of struggling on my Windows XP x64 machine, with MySQL 5.1.30 (x64) and Rails 2.3.2 installed, this above suggestiong helped me. Download libMySql.dll from here (http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/) and putting it in ruby\bin solved the problem.

aronchick
The linked-to solution appears to be a hack. I'm not happy with solutions that seem like black magic. Couldn't this really be a problem with using the 64 bit version of MySQL with Rails (or maybe just with WEBrick)? I'm going to continue experimenting by downloading and installing the 32 bit version of MySQL instead of mixing in a DLL from the version in the InstantRails bundle.
Mark Freedman
It's a hack to be sure - it's because MySQL support for Windows is spotty at best.
aronchick
A: 

This error occurs if you have a file with name "Program" in the root of your drive. Say for example you are trying to execute "C:\Program Files\SomeApp\Bin\SomeExe.Exe" it tries to execute "C:\Program" if it exists. In some situations a file with this name get created if you forget to quote "C:\Program Files..." with some commandline commands. This of course also applies for you D: drive, etc.

This error often occurs if you try to start services, but may occur in other situations.

Simply deleting the file C:\Program or D:\Program etc. solves the problem.

Hi--- this wasn't the problem for me, since I don't have a program like that on the root of my drive.
aronchick