Coder Social home page Coder Social logo

Comments (11)

swaldman avatar swaldman commented on May 30, 2024

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.

 avatar commented on May 30, 2024

http://www.heypasteit.com/clip/109R

from c3p0.

swaldman avatar swaldman commented on May 30, 2024

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.

swaldman avatar swaldman commented on May 30, 2024

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.

 avatar commented on May 30, 2024

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.

swaldman avatar swaldman commented on May 30, 2024

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.

 avatar commented on May 30, 2024

We don't call it any time...just once. We try to switch back to documented and see if there are differences

from c3p0.

swaldman avatar swaldman commented on May 30, 2024

let me know how it goes! thanks!

from c3p0.

 avatar commented on May 30, 2024

we wanted to start testing today, but we cannot create c3p0-pre6.jar.
how do you build this jar?

from c3p0.

 avatar commented on May 30, 2024

ok, i tried with pre5 and changed the code, as you wanted. it works fine.
thanks! now looking forward for final release :-)

from c3p0.

swaldman avatar swaldman commented on May 30, 2024

i'm glad it's worked out!

from c3p0.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.