pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: Dave Cramer <davecramer@postgres.rocks>
To: Rob Bygrave <robin.bygrave@gmail.com>
Cc: pgsql-jdbc@lists.postgresql.org <pgsql-jdbc@lists.postgresql.org>
Subject: Re: embeded tomcat and correct DataSource.
Date: Tue, 17 Nov 2020 16:22:07 -0700
Message-ID: <dd7bb079-7123-c0b1-7cec-a4f3807b2f54@gmail.com> (raw)
In-Reply-To: <CADK3HHLpCNvcZPSd0skQ2v1d5h5rH_cMeXw5BMBAmSMCFLDA2g@mail.gmail.com>
References: <0f62f2cb-7474-0af5-3bbe-c3747c079dcb@gmail.com>
	<CADK3HHKJ--69hJzfiGzT9eUwB_i_TTds9BU+ZKgERgkaV+HftQ@mail.gmail.com>
	<CAC=ts-HbFEfi6JH59Vd_r_Wqpu00P9zcoSd48vYJVtdVwxBTMA@mail.gmail.com>
	<CADK3HHLpCNvcZPSd0skQ2v1d5h5rH_cMeXw5BMBAmSMCFLDA2g@mail.gmail.com>


On 11/17/20 4:04 PM, Dave Cramer wrote:
>
> On Tue, 17 Nov 2020 at 17:57, Rob Bygrave <robin.bygrave@gmail.com 
> <mailto:robin.bygrave@gmail.com>> wrote:
>
>     Hi,
>
>     Sorry I'm probably mis-interpreting your question. Hopefully the
>     comments below are useful.
>
>
>     /> I should use the PGConnectionPoolDataSource if I wish to use
>     Apache connection pool mechanism./
>
>     In short, I'm pretty sure the answer is no.
>
>     The longer answer is, PGPoolingDataSource is the DataSource
>     implementation provided in pgjdbc. PGPoolingDataSource is
>     */deprecated/* with the comment below and noting that
>     PGPoolingDataSource uses PGConnectionPoolDataSource (as an
>     implementation detail).  We could think
>     of PGConnectionPoolDataSource as part of the DataSource
>     implementation provided with postgresql jdbc driver that is marked
>     as deprecated (with the suggestion that we migrate to any other
>     third party DataSource implementation).
>
>     * @deprecated Since 42.0.0, instead of this class you should use a
>     fully featured connection pool
>
>     * like HikariCP, vibur-dbcp, commons-dbcp, c3p0, etc.
>
>
>
>     Any third party javax.sql.DataSource implementation would be
>     extremely unlikely to use anything in the /org.postgresql.ds/
>     package including PGConnectionPoolDataSource.
>
>
> Rob,
>
> Thanks for catching this. I mis-read the question.
>
> Rob is correct! Do not use the PGPooling source for anything. It is 
> really there for completeness. There are so many other good pooling 
> implementations it just does not make sense for us to re-implement one.
>
> Dave Cramer
> www.postgres.rocks
>
>

Yes, that was corrected after I posted before I got /anything/ to work.


    current wiring is:

    ContextResource contextResource =new ContextResource();

    contextResource.setName("jdbc/sgsdb");
    contextResource.setType("javax.sql.DataSource");
    contextResource.setProperty("url","jdbc:postgresql://localhost:5432/version4007");
    contextResource.setProperty("driverClassName","org.postgresql.Driver");
    contextResource.setProperty("username","postgres");
    contextResource.setProperty("password","notnull");
    contextResource.setProperty("testWhileIdle","false");
    contextResource.setProperty("testOnBorrow","true");
    contextResource.setProperty("validationQuery","SELECT 1");
    contextResource.setProperty("testOnReturn","false");
    contextResource.setProperty("validationInterval","30000");
    contextResource.setProperty("timeBetweenEvictionRunsMillis","30000");
    contextResource.setProperty("maxActive","50");
    contextResource.setProperty("initialSize","5");
    contextResource.setProperty("maxWait","10000");
    contextResource.setProperty("removeAbandonedTimeout","60");
    contextResource.setProperty("minEvictableIdleTimeMillis","30000");
    contextResource.setProperty("minIdle","3");
    contextResource.setProperty("logAbandoned","true");
    contextResource.setProperty("removeAbandoned","true");

    contextResource.setProperty("factory","org.apache.tomcat.jdbc.pool.DataSourceFactory");
    ctx.getNamingResources().addResource(contextResource);

where ctx is the webapp context.

Thanks for reading!

view thread (7+ messages)

Message-ID: <dd7bb079-7123-c0b1-7cec-a4f3807b2f54@gmail.com>
Permalink:  ../dd7bb079-7123-c0b1-7cec-a4f3807b2f54@gmail.com/
Also on:    postgresql.org/message-id/dd7bb079-7123-c0b1-7cec-a4f3807b2f54@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: robjsargent@gmail.com, davecramer@postgres.rocks, robin.bygrave@gmail.com
  Subject: Re: embeded tomcat and correct DataSource.
  In-Reply-To: <dd7bb079-7123-c0b1-7cec-a4f3807b2f54@gmail.com>
  References: <0f62f2cb-7474-0af5-3bbe-c3747c079dcb@gmail.com> <CADK3HHKJ--69hJzfiGzT9eUwB_i_TTds9BU+ZKgERgkaV+HftQ@mail.gmail.com> <CAC=ts-HbFEfi6JH59Vd_r_Wqpu00P9zcoSd48vYJVtdVwxBTMA@mail.gmail.com> <CADK3HHLpCNvcZPSd0skQ2v1d5h5rH_cMeXw5BMBAmSMCFLDA2g@mail.gmail.com> <dd7bb079-7123-c0b1-7cec-a4f3807b2f54@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox