Forum: Ruby ruby/mysql connection close problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Adam H. (Guest)
on 2008-10-20 22:07
Hello,

I am using the Ruby/mysql module installed from gems and everything is
working fine except the connections arent closing. I was under the
impression that upon completion of a script the database handle will
close automatically but regardless even by explicitly stating
dbh.close() at the end of the script I cant get the database to close
the connection. This is obviously a problem as the limit of connections
is eventually reached.

I am running apache2 on ubuntu 7.10, I am calling the ruby script (that
connects and queries the database) from embedded ruby in an .rhtml file.

I do not have the code available right now as I am posting from another
computer but can post the code if anyone thinks it will help.

Any help appreciated,

Thanks
Roger P. (Guest)
on 2008-10-21 07:23
> I am running apache2 on ubuntu 7.10, I am calling the ruby script (that
> connects and queries the database) from embedded ruby in an .rhtml file.
>
> I do not have the code available right now as I am posting from another
> computer but can post the code if anyone thinks it will help.
>
> Any help appreciated,
>
> Thanks


I suppose if you got really desperate you could use mysqlplus then hard
force close the connection.

descriptor_number = conn.socket
a = IO.new(descriptor_number)
a.close
Maybe.
-=R
This topic is locked and can not be replied to.