Or maybe another possibility is to store the DataSource in the 
ConfigurationContext instead of the connection and just get connections from 
the persisted DataSource each time the service is invoked.  I'll give it a try 
next week.  Thanks again.

-----Original Message-----
From: Gemoets, Darren [mailto:darren.gemo...@aquilent.com] 
Sent: Friday, September 21, 2012 15:04
To: java-user@axis.apache.org
Subject: RE: Problems using Tomcat 7 connection pool to PostgreSQL with Axis2

Interesting...I had run across ServiceLifeCycle somewhere along the way and 
wondered if that should be part of my solution.  But I guess what happens with 
that approach is that it persists a single DB connection for the entire 
lifetime of the web service-- that is, until either Tomcat is restarted or the 
Axis service is un/re-deployed...right?  Like Andreas implies, that's sort of 
counter to the idea of a connection pool.

That said, if the ServiceLifeCycle approach obviates the need for a connection 
pool, yet provides many the same advantages (and more importantly-- works), 
then I guess I should ditch the connection pool and adopt the persistent DB 
connection.  I do also wonder about keeping the DB connection open 
indefinitely.  Intuitively, it seems like something would time out or 
ultimately the connection would go bad in some way-- with no recourse other 
than to restart Tomcat or redeploy the service.  Maybe before each query I test 
the connection for validity and create a new one if it's bad, saving it in the 
ConfigurationContext?

Anyway, thank you for the responses.

Darren

-----Original Message-----
From: Andreas Veithen [mailto:andreas.veit...@gmail.com] 
Sent: Friday, September 21, 2012 14:52
To: java-user@axis.apache.org
Subject: Re: Problems using Tomcat 7 connection pool to PostgreSQL with Axis2

> This might give you some light.
>
> http://www.developer.com/db/article.php/3735771/Exposing-a-Database-as
> -a-Web-Service.htm
>
> Deepal

Darren said that he is using a connection pool, not the DriverManager API. In 
that case, you manage connections differently than the pattern shown in your 
article. If you use that pattern together with a container managed connection 
pool, then it becomes an anti-pattern.

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
For additional commands, e-mail: java-user-h...@axis.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
For additional commands, e-mail: java-user-h...@axis.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
For additional commands, e-mail: java-user-h...@axis.apache.org

Reply via email to