Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Datasource Connection Pool c3p0

Reply
Thread Tools

Datasource Connection Pool c3p0

 
 
Saburo Saburo is offline
Junior Member
Join Date: Jun 2008
Posts: 1
 
      06-27-2008
Hello all,
first thing : I am not really a java expert, coding a bit -enjoying it- but there are some things that I do not understand.

I am trying to design and code an application (using tomcat 5, with servlets, no beans at the moment) that uses a repository (most likely mysql, but generally a database) and may need to perform many queries against other "n" databases with connections defined by "powerusers".

Looking in this forum and googling around a bit I discovered it would be good to use cp30 with ComboPooledDataSource.
I tested it and it works, so far so good.
Now the problem(s) :

1) I understood (from some posts in this forum) that it is considered better to define the resources in the server.xml file rather than create them dynamically.
It would be quite inconvenient for my app as database connections may be defined by users with the right auth level. Is there, for such a situation, a better solution than bind jndi names in the sourcecode (pars are actually stored in the app repository)?

2) I discovered that ctx.lookup is also an expensive thing to do... then I am in trouble here.
Someone suggested to create a datasource and keep it alive, setting it in the init().
That may work for the repository, not sure how to handle the other "n" connections. (a list, an array... whatever).
How can I create those objects and keep them "alive" for my app? Should I use a listener servlet? (ok, I told you I am not an expert...)

Any suggestion is welcome.
Thanks in advance.

Francesco
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic NAT pool doesn't report full when pool contains interface IP tom Cisco 0 10-09-2009 02:22 AM
does python have a generic object pool like commons-pool in Java Rick Lawson Python 8 07-16-2009 11:25 PM
PIX 501 issue routing between VPN pool and local pool eostrike Cisco 3 10-24-2008 09:43 PM
Connection Pooling - c3p0 - Tomcat. Chris Smith Java 6 05-31-2008 09:17 AM
Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. Guoqi Zheng ASP .Net 4 06-03-2004 06:39 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57