[opencms-dev] How to use the connection pool?
Andreas Schouten
Andreas.Schouten at framfab.de
Wed Aug 1 15:10:58 CEST 2001
Class.forName("com.opencms.dbpool.CmsDriver");
Hi,
you cannot register a pool like this:
// code starts
CmsPool cp = new CmsPool
(
"jdbc:opencmspool:genericsql",
"com.sybase.jdbc2.jdbc.SybDriver",
"jdbc:sybase:Tds:x.x.x.x:y/opencms",
"user",
"password",
10,
20,
5,
120,
360
);
(After this you have created a pool, but the CmsDriver don't know that it
exists)
OpenCms manages the pools itself. Therefor it creates a pool on demand it is
asked the first time with:
con = DriverManager.getConnection("jdbc:opencmspool:genericsql");
So you have to configurate the pool in a property file (like you have seen
in the opencms.properties). Use code like this:
// set configurations for the dbpool driver
com.opencms.dbpool.CmsDriver.setConfigurations(config);
"config" is the configuration-object that reads from the properties-file.
After that you can use:
con = DriverManager.getConnection("jdbc:opencmspool:genericsql");
Regards,
Andreas
More information about the opencms-dev
mailing list