According to the Tomcat 7 "JNDI Resources HOW-TO" part "JDBC resources" documentation one or more initial SQL statement(s) for each created connection can be specified using "connectionInitSqls" attribute on the Resource element. Looking at class BasicDataSource this property is indeed there (field "connectionInitSqls") However, the class BasicDataSourceFactory, the JNDI factory used by Tomcat to create a BasicDataSource instance, uses another attribute-name for this property: ... private final static String PROP_INITCONNECTIONSQLS = "initConnectionSqls"; ... ... value = properties.getProperty(PROP_INITCONNECTIONSQLS); if (value != null) { StringTokenizer tokenizer = new StringTokenizer(value, ";"); dataSource.setConnectionInitSqls(Collections.list(tokenizer)); } ... My suggestion is to keep the documentation as is and update the class BasicDataSourceFactory. For example like this (of course field name may also be updated too, to reflect the property name) : ... private final static String PROP_INITCONNECTIONSQLS = "connectionInitSqls"; ...
This is https://issues.apache.org/jira/browse/DBCP-348 We need a Commons DBCP 1.4.1 release in order to fix this.
Fixed in: - 7.0.x for 7.0.94 onwards