On Tue, 17 Nov 2009 08:53:05 +0900, Rob Mauchel wrote:

> It doesn't matter whether new data is being written to the db or
> existing data is being read from it. Either way, activerecord generates
> the aforementioned "Mysql::Error: query: not connected" exception.

hmm.  Dunno on that one.  Personally, I would still try a SQLite for 
comparison.  You could try raw SQL if it's just AR acting oddly (it seems 
unlikely to be a bug, but that's always possible).

> As described in the first post, the table for this simple illustrative
> example is named 'a' and has one field/column named 'x'.

Ah, ok, you can go into mysql and describe somedb.a, and can insert data 
into that db logged in as whatever user you're trying from ruby?  Pardon.

[...]
> If however all of these are correct, no error occurs from attempting to
> establish the connection. Instead, the aforementioned "Mysql::Error:
> query: not connected" exception is generated when activerecord tries to
> execute the SQL query associated with the operation being performed
> (read or write - as I said, doesn't matter which).

Could that be a mysql permissions problem?  Else, I dunno.

> I've confirmed from debugging now that the connection is being made on
> line 585 of activerecord's file mysql_adapter.rb (call to
> @connection.real_connect - not actually hit until my statement above,
> 'user = User.new("x" => 5)', is performed).
> 
> Unfortunately, it's not possible to step into the above call to
> real_connect to see why no connection actually occurs - presumably
> because it's in a binary library (libmysql.dll). But the parameters
> passed in are as expected.

Well, it may not be MySQL nor ruby, per se.  Personally, I'd try both a 
different db and maybe a different box if the code and db seem fine.  
Other than that, I really don't know.  




That's all I got, hope it helps,


Thufir