Increasing max_connection also not working. I ran the application 50-60 
times in few span of seconds (at each call it creates 3-4 databse objects) 
and now it is giving me same error. "Too many connections"

I think I need to close/disconnect the DB for each thread I have in the app.

Also, is there a way externally I can check the number of connections to 
the database or close all connections (out of app)?


On Tuesday, August 28, 2012 11:32:44 AM UTC-7, Jeremy Evans wrote:
>
> On Tuesday, August 28, 2012 9:49:09 AM UTC-7, Ravi wrote:
>
>> On Monday, August 27, 2012 6:29:16 PM UTC-7, Jeremy Evans wrote:
>>
>>> Do this instead:
>>>
>>>   # Do this exactly once when starting your app
>>>   DB = Sequel.connect("mysql:...")
>>>
>>
>> So, should this connection be closed at end of the application?? 
>>
>
> You shouldn't need to close it manually, but if you want to call 
> DB.disconnect before exiting, that shouldn't cause any problems. 
>
>  
>
>>   # do this each time you want to add/update
>>>   DB[:test_table].add(list_of_param)
>>>   DB[:test_table].update(list_of_param)
>>>
>>> If you must wrap it in a class:
>>>
>>>   # classes in ruby must start with a capital letter
>>>   class DbConnect
>>>     DB = Sequel.connect("mysql:...", :max_connection=>3, 
>>> :pool_sleep_time=>0.01, :pool_timeout=>30)
>>>
>>
>> I have did this change earlier, but here why we need max_connection=>3 
>> and can we use single_threaded because either ways the connection used is 1 
>> only ..
>>
>>
> If your application is single threaded, using :single_threaded is best 
> because the single threaded pool is faster (no locking).  If your 
> application is not single threaded and you use :single_threaded, you are 
> entering a world of pain.
>
> Jeremy 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/tj-t02YEmbEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to