Comments (11)
hi,
thank for the issue! so far i've not been able to reproduce it, though. can i ask, what's in props? can you send the code that you use to set that up?
many thanks.
from c3p0.
http://www.heypasteit.com/clip/109R
from c3p0.
thanks!
so, a quick response.
i can reproduce your issue now. and i'd like for what you are doing to work, and will look into fixing it.
that said, you should never have had to do what you did! the cfg package of c3p0 and the class C3P0Config are not intended for client use (even though much of the api is sloppily public, so that other code in other c3p0 packages can see it). what you are trying to do is simply to construct a pooled DataSource with a named config. Rather than extracting the properties for the named config by hand and calling pooledDataSource( ... ) with those properties, the intended api for that would just be to call [pooledDataSource( DataSource unpooledDataSource, String configName)](http://www.mchange.com/projects/c3p0-0.9.5-pre5/apidocs/com/mchange/v2/c3p0/DataSources.html#pooledDataSource%28javax.sql.DataSource, java.lang.String%29), as is documented here. that code path seems to be working just fine. (the example in the documentation includes a version of pooledDataSources( ... ) with an additional overrideProps parameter, but if you don't want to override anything you've setup in your config files, use the version that omits that.)
i will look into cleaning up the properties that come out of a direct call to C3P0Config.getUnspecifiedUserProperties( namedConfig ), and respond further. But if you just want to solve your problem (and make your code simpler!) get rid of any access to the cfg package within c3p0 and just call pooledDataSource( DataSource unpooledDataSource, String configName)
from c3p0.
OK. the first commit towards c3p0-0.9.5-pre6 (and the current maven snapshot of that release) cleans up this issue, so that the initialization technique you use will work. You'll still see some warning messages, as the full property list that you extract with C3P0Config.getUnspecifiedUserProperties( namedConfig ) includes properties that can't be set at the PooledDataSource level and so are ignored. But beyond that, everything should be fine.
That said, it's still probably best to just initialize with a named config in the usual way...
Thanks again for finding this issue.
from c3p0.
as far as i remember, we first did it like it was documented. But with that, performance was slower than with hibernate (which we removed from our ptoject). Then we tried a lot, to get better performance than before, and this way was the most perfomant. But we just tried a lot. Maybe we choose the wrong way to improve performance.
from c3p0.
hi,
this initialization shouldn't affect performance significantly at all, as you should be initializing your DataSources just once and then using them indefinitely. if you are calling this method every time you need a DataSource, rather than storing a reference to the DataSource and reusing it, you'll have terrible performance. i doubt very much that you are doing that, though.
but, one way or another, you should be calling this method basically once when your application starts up. there might be a performance difference between the documented initialization and the one you've used, but it'd be no more than a few milliseconds just once in your application lifecycle. if this code is performance-critical to your application, there's something more seriously wrong, and you'll want to fix that.
in any case, the problem you reported should be resolved. still, i would switch back to the documented initialization, and if that slows things down, i'd want very much to understand why.
good luck!
from c3p0.
We don't call it any time...just once. We try to switch back to documented and see if there are differences
from c3p0.
let me know how it goes! thanks!
from c3p0.
we wanted to start testing today, but we cannot create c3p0-pre6.jar.
how do you build this jar?
from c3p0.
ok, i tried with pre5 and changed the code, as you wanted. it works fine.
thanks! now looking forward for final release :-)
from c3p0.
i'm glad it's worked out!
from c3p0.
Related Issues (20)
- issue with setCatalog() using c3p0 for ms sqlserver, but works fine with a direct Connection without a pool HOT 2
- DEADLOCK in C3P0PooledConnectionPoolManager when calling java.net.InetAddress.getLocalHost HOT 1
- Sporadic java.sql.SQLException: No suitable driver HOT 1
- Project health HOT 2
- How to continue on error?
- Snowflake integration with c3p0 fails when private key is set in properties HOT 2
- Aborted DB connection after JUnit Tests completed HOT 1
- password in null when using com.microsoft.sqlserver.jdbc.SQLServerDriver HOT 1
- C3p0 Error HOT 1
- about high concurrency properties
- NewProxyPreparedStatement nondeterminism HOT 2
- java.util.ConcurrentModificationException on stmtSet iterator.Next() call in GooGooStatementCache.checkinAll HOT 1
- c3p0 continues attempting connections long after being closed HOT 1
- Make `ConnectionCustomizer` a bit easier to work with regarding class loaders HOT 1
- Licence file does not exist in the source jar HOT 1
- Is project officially dead? HOT 4
- mchange.v2.c3p0.impl.NewPooledConnection - [c3p0] The following Exceptions occurred while trying to clean up a Connection's stranded resource HOT 1
- Add Automatic-Module-Name to Manifest HOT 2
- C3P0 Driver Issue
- Compatibility with JDK 17 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from c3p0.