Creating a connection pool object datasource using the configuration file properties
As follows:
1 Public classCp30util {2 Private StaticDataSource DataSource;3 //use static blocks of code so that the driver is loaded when the tool class is invoked and loaded only once4 Static {5 Try {6 //Create DataSource Connection pool objects using the factory method "using the Datasouces factory class"7Datasource=Datasources.pooleddatasource (Datasources.unpooleddatasource ());8}Catch(Exception e) {9 e.printstacktrace ();Ten } One}
1 /* 2 Note: CP30 in the properties have the specified format, according to the requirements of the configuration file created, unordered in the program in the loading of files, will automatically load, see friends chain: http://haoran-10.iteye.com/blog/1753332 3 */
cp30--Creating a connection pool object datasource using the configuration file properties