« Return to Thread: Is this forum still active ?

Re: Is this forum still active ?

by stlecho :: Rate this Message:

Reply to Author | View in Thread

Hi John,

Thanks for your clarifications. I would be pleased if you could add the answers to the relevant messages, so that I can comment on them.

Regards, Stefan Lecho.

John & Diane Sumsion wrote:
Hi Stefan,

I read all the messages that come to this list.

Most of them are regarding some kind of problem getting connections
out of the pool.  There are as many answers to that question as there
are users of c3p0. :)

As a rule, I don't answer questions that can be answered by reading
c3p0 code.  However, I didn't realize this list had got so quiet, so
I'll do my best to answer your recent questions.

1) how to integrate C3P0 with Active Directory for the retrieval of DB user/pwd
That would probably require custom instantiation of a c3p0 data
source, reading settings from Active Directory and explicitly
configuring your pool using the methods on DataSources.

2) using JMX to get information about the pooled connections
There are lots of JMX beans exposed.  We didn't try to write code to
navigate them all, we just find the ones we wanted to watch, and then
wrote code that looked at the settings on that one, watching for
problems.

3) "acquire test -- pool is already maxed out" showing up in app logs
Your logging settings are set to have too much detail in your logs.

4) determine a correct value for the maxPoolSize property
This is an equation that has the following factors:
- how many web request threads are allowed by your servlet container
- how long do you expect to hold onto a JDBC connection when you check one out
- how much of your web request time is spent doing something that does
NOT need a JDBC connection
Then you could guess at a reasonable value for the min and max
connection pool size.
Then you could measure whether this works.  We had to add
instrumentation around how long it took to get a connection and start
alerting if it took longer than a certain threshold.  Then we adjusted
our pool configuration based on whether we got alerts.  Most the
problems I've seen have been related to our Oracle database not
responding to login requests in a timely manner.

5) CVS repository of C3PO
There is no CVS repository, download the "c3p0-src" package from
sourceforge.net.

Somebody else asked:
6) how to get the sql exception thrown by the native sql driver
We had to patch c3p0 to do this (based on c3p0-0.9.1-pre11).  Steve
didn't like our patch, so he didn't apply it.  I'm including it here
for the benefit of anyone who cares.  This also includes doing "new
Hashtable()" which is required if you're using an old Oracle AQ driver
that has a dirty cast in it and doesn't deal with
Collections.EMPTY_MAP.

Sorry for what my email client or this list may do to this patch.
I've not had luck with attachments on this list.

Index: src/classes/com/mchange/v2/c3p0/PooledDataSource.java
===================================================================
RCS file: /usr/cvs-0.9/tools/c3p0/src/classes/com/mchange/v2/c3p0/PooledDataSource.java,v
retrieving revision 1.1.1.4
retrieving revision 1.4
diff -r1.1.1.4 -r1.4
199c199,200
<
---
>     public Throwable getLastAcquisitionFailure() throws SQLException;
>
204c205,206
<
---
>     public Throwable getLastAcquisitionFailure(String username, String password) throws SQLException;
>
Index: src/classes/com/mchange/v2/c3p0/impl/AbstractPoolBackedDataSource.java
===================================================================
RCS file: /usr/cvs-0.9/tools/c3p0/src/classes/com/mchange/v2/c3p0/impl/AbstractPoolBackedDataSource.java,v
retrieving revision 1.1.1.2
retrieving revision 1.4
diff -r1.1.1.2 -r1.4
240c240,244
<
---
>
>   public Throwable getLastAcquisitionFailure() throws SQLException {
>     return getPoolManager().getPool().getLastAcquisitionFailure();
>   }
>
252c256,259
<
---
>
>     public Throwable getLastAcquisitionFailure(String username, String password) throws SQLException
>     { return assertAuthPool(username, password).getLastAcquisitionFailure(); }
>
482d488
<
Index: src/classes/com/mchange/v2/c3p0/impl/C3P0PooledConnection.java
===================================================================
RCS file: /usr/cvs-0.9/tools/c3p0/src/classes/com/mchange/v2/c3p0/impl/C3P0PooledConnection.java,v
retrieving revision 1.1.1.4
retrieving revision 1.5
diff -r1.1.1.4 -r1.5
374c374
<    { if (supports_setTypeMap) physicalConnection.setTypeMap(
Collections.EMPTY_MAP ); }
---
>    { if (supports_setTypeMap) physicalConnection.setTypeMap( new Hashtable(20) ); }
378c378
<    logger.log(MLevel.FINE, "A Throwable occurred while trying to
reset the typeMap property of our Connection to
Collections.EMPTY_MAP!", t);
---
>    logger.log(MLevel.FINE, "A Throwable occurred while trying to reset the typeMap property of our Connection to new Hashtable(20)!", t);
Index: src/classes/com/mchange/v2/c3p0/impl/C3P0PooledConnectionPool.java
===================================================================
RCS file: /usr/cvs-0.9/tools/c3p0/src/classes/com/mchange/v2/c3p0/impl/C3P0PooledConnectionPool.java,v
retrieving revision 1.1.1.4
retrieving revision 1.4
diff -r1.1.1.4 -r1.4
833a834,842
>     public Throwable getLastAcquisitionFailure() throws SQLException {
>         try { return rp.getLastAcquisitionFailure(); }
>         catch (Exception e) {
>             //e.printStackTrace();
>             logger.log(MLevel.WARNING, null, e);
>             throw SqlUtils.toSQLException(e);
>         }
>     }
>
Index: src/classes/com/mchange/v2/c3p0/impl/NewPooledConnection.java
===================================================================
RCS file: /usr/cvs-0.9/tools/c3p0/src/classes/com/mchange/v2/c3p0/impl/NewPooledConnection.java,v
retrieving revision 1.1.1.4
retrieving revision 1.5
diff -r1.1.1.4 -r1.5
108c108
< this.dflt_typeMap                      = (supports_setTypeMap &&
(carefulCheckTypeMap(con) == null) ? null : Collections.EMPTY_MAP);
---
> this.dflt_typeMap                      = (supports_setTypeMap && (carefulCheckTypeMap(con) == null) ? null : new Hashtable(20));
Index: src/classes/com/mchange/v2/resourcepool/BasicResourcePool.java
===================================================================
RCS file: /usr/cvs-0.9/tools/c3p0/src/classes/com/mchange/v2/resourcepool/BasicResourcePool.java,v
retrieving revision 1.1.1.4
retrieving revision 1.7
diff -r1.1.1.4 -r1.7
128a129
>     Throwable lastAcquisitionFailure;
159a161,163
>     public synchronized Throwable getLastAcquisitionFailure()
>     { return lastAcquisitionFailure; }
>
1797a1802
>                         lastAcquisitionFailure = e;
2049d2053
<
Index: src/classes/com/mchange/v2/resourcepool/ResourcePool.java
===================================================================
RCS file: /usr/cvs-0.9/tools/c3p0/src/classes/com/mchange/v2/resourcepool/ResourcePool.java,v
retrieving revision 1.1.1.4
retrieving revision 1.4
diff -r1.1.1.4 -r1.4
112c112,114
<
---
>   public Throwable getLastAcquisitionFailure()
>     throws ResourcePoolException;
>

John...

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
c3p0-users mailing list
c3p0-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/c3p0-users

 « Return to Thread: Is this forum still active ?