Good evening! Tell me

c3p0 methods for getting a datasource -

DataSources.unpooledDataSource(String jdbcUrl, Properties driverProps) 

and

 DataSources.pooledDataSource( DataSource unpooledDataSource, Map overrideProps ) 

work with the same mix?

When creating a pool of connections, you can create unpooledDataSource simply by url driver + login password to the database and already in the pooledDataSource specify by redefining check pool pool connections, settings, lifetime etc., etc. - right? Or the set of properties that are specified in the signatures of the methods are mapped into different maps of the parameters of the data that I will pull out of the created pool?

    1 answer 1

    Properties driverProps can only contain Properties JDBC drivers, which usually only contain user and password

    Map overrideProps can contain all other properties. See c3p0's configuration properties .

    Although usually overrideProps not used and all properties are specified in configuration files (usually in c3p0.properties , although c3p0 offers many ways to specify the configuration).

    Most likely it will be more convenient for you to create a ComboPooledDataSource . In general, all properties in your config become default, but they can always be overridden by the methods setXXX (where XXX is any setting / property).

    • Thank you. This is exactly what I wanted to hear. I can’t use ComboPooledDataSource because I need to use dbc properties, such as the dash (postgres, oracle) - stoxa
    • I'm glad to help. JDBC driver properties, you can use ComboPooledDataSource if you wish. ComboPooledDataSource has a method called setProperties(...) , which is the driver properties that will be used. If you are using a JDBC driver, you can use this method. - Steve Waldman
    • (If you really want to, you can call the setProperties(...) , you can setProperties(...) the jDBC driver properties object password directly.) - Steve Waldman