Hi,

I agreed with Dmytro. This approach gives you good manageability of your DB 
connection pool.
—
Sincerely,
Fan Jiang

On Fri, Apr 3, 2015 at 4:58 PM, Dima Dragan <[email protected]>
wrote:

> Hi,
> You can create static class with thread-safe singleton initialization of
> connection pool and provide public access for reference.
> Take pool reference in prepare method.
> Take connection,execute smth, give it back in execute method.
> So every worker will get it's own pool.
> Best regards,
> Dmytro Dragan
> On Apr 3, 2015 11:47 PM, "Nathan Leung" <[email protected]> wrote:
>> Do it in prepare.  The topology created in main() is serialized and sent
>> via thrift to the nimbus.  It is not possible to serialize and deserialized
>> things like a database connection.  The config map is one way you can pass
>> pool configuration information though.
>>
>> On Fri, Apr 3, 2015 at 4:37 PM, Adam Mitchell <
>> [email protected]> wrote:
>>
>>> Where is the best place to create a JDBC connection pool, and register it
>>> so that all of my bolts can access it?  To borrow from the examples, would
>>> you do that near WordCountTopology::main() and save the pool reference in
>>> the Config map?  That way IBolt::prepare() can use the map...
>>>
>>> Or the TopologyContext is also available in IBolt::prepare().  Would you
>>> put it there somehow?
>>>
>>> If you're doing database dips in your bolts, how are you managing your
>>> database connections?
>>>
>>
>>

Reply via email to