|Subject||Re: [Firebird-Java] DataSource question|
On Sep 3, 2004, at 9:12 AM, Juan Pedro López Sáez wrote:
> Hello All,This is the correct approach.
> This is a very simple question.
> I'm using Jaybird 1.0.1, Tomcat and DBCP to implement a DataSource for
> my database connections.
> Till now I have a servlet Filter where I first initialize the
> (in the Filter.init() method). For every request I get a database
> Connection calling DataSource.getConnection() inside a synchonized
> (in the Filter.doFilter() method). When the request finishes, the
> closes the connection. So, every database connection is kept opened
> while the request is in process.
> Now I want some requests to behave in a different fashion. I want them
> to spawn a thread to make some long processing tasks in background.
> initial request will instead response to the client as soon as
> The matter is that I need to provide the new thread a database
> connection which remains opened till the job is done.
> My first solutions has been to pass the DataSource reference to the
> thread so that it can get its own database connection.
> Question: is DataSource.getConnection() thread-safe?
> Is it java databaseno
> driver dependent?
> Are there any related to constraints?Not that I know of.
> I guess if it is really thread-safe I could probably remove the
> synchonized block in my filter.
> Thank you very much.
> Juan Pedro Lopez
> Yahoo! Groups Sponsor
> Yahoo! Groups Links
> • To visit your group on the web, go to:
> • To unsubscribe from this group, send an email to:
> • Your use of Yahoo! Groups is subject to the Yahoo! Terms of