From: Brian Candler Date: 2009-01-20T05:55:13+09:00 Subject: Re: db class and connection problems Luis Moran wrote: ... > and I get an error Show the *exact* error - I mean copy-paste it, including the backtrace. Cross-reference backtrace entries which refer to your own code to the actual lines of your source. It would also be useful if you could give a complete small program which replicates the problem, because it could just be a typo. At first glance what you've written looks fine, but it's not runnable - e.g. there's no require 'mysql-ruby' or require 'ruby-mysql'. Also, it's worth mentioning which mysql library you're using, and what version. > cause the database seem to be closed... or which is > the same @connection is null? Those are two very different things. One says that @connection points to some object, but the object says the database connection is closed (it may have been closed due to some sort of error, for example). The other says @connection points to nothing at all (well, technically an instance of the 'nil' object), which could only happen if your own code set @connection = nil. > I only can make it work if I open and > close the database from inside the query method, but this query is > called more than 4000 times in the script and I reach the limit of > connections of my system's TCP/IP If that's true, then clearly you're not closing each connection after using it. Regards, Brian. -- Posted via http://www.ruby-forum.com/.