A good question - I know you can re-connect by re-calling the setup
method, but I don't know how to disconnect explicitly.  You might try
running setup with an invalid connection.

DataMapper.setup(:default, 'mysql://localhost/the_database_name') -
can be called again to reset the default connection.

I did check the mysql adapter, but its mostly in C and connection to
the mysqlib so harder to figure out - Hopefully someone else can write
back who knows the database API internals :)

If you have access to your mysql server, you might set the close-idle-
connection setting to a very low value, and just not worry about it.
The repositories will automatically auto-connect when you try to use
them, and the lost cycles of reconnecting sound like won't bother you
since you dont make that many calls.

Ciao,
Kevin


On Jul 20, 11:22 am, Jonathan Badger <jhbad...@gmail.com> wrote:
> I am writing a bioinformatics tool that uses a database (MySQL)  to
> store and fetch data as needed. This tool is generally run on a
> distributed system with over a thousand nodes, all or some of which
> may be used by my tool depending on who else is using the system. The
> problem is that we are not allowed more than 50 concurrent connections
> to the MySQL server. So each instance of the tool can't keep a
> connection to itself. I have dealt with this in the current version of
> my tool which uses the MySQL bindings directly by opening a connection
> (waiting if no free connections are available), talking to the
> database, and then closing the connection, freeing it for other
> instances running on other nodes. Since the majority of the time each
> instance doesn't need to talk to the database and is instead
> performing analysis on the retrieved data, 50 connections is plenty
> for even thousands of simultaneous instances.
>
> Now I would like to use Datamapper rather than raw SQL. Is such
> managing of connections possible in Datamapper?
>
> Jonathan

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to datamap...@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to