SOLR-1450 -- Jdbc connection properties such as batchSize are not applied if the driver jar is placed in solr_home/lib

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@817634 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2009-09-22 12:23:44 +00:00
parent 2652eabbbd
commit 2d7502ecf4
2 changed files with 13 additions and 7 deletions

View File

@ -258,6 +258,10 @@ Bug Fixes
(Jay Hill, Noble Paul via ehatcher)
29.SOLR-1323: Reset XPathEntityProcessor's $hasMore/$nextUrl when fetching next URL (noble, ehatcher)
30.SOLR-1450: Jdbc connection properties such as batchSize are not applied if the driver jar is placed
in solr_home/lib.
(Steve Sun via shalin)
Documentation

View File

@ -153,6 +153,15 @@ public class JdbcDataSource extends
"the jndi name : '"+jndiName +"' is not a valid javax.sql.DataSource");
}
}
} catch (SQLException e) {
// DriverManager does not allow you to use a driver which is not loaded through
// the class loader of the class which is trying to make the connection.
// This is a workaround for cases where the user puts the driver jar in the
// solr.home/lib or solr.home/core/lib directories.
Driver d = (Driver) DocBuilder.loadClass(driver, context.getSolrCore()).newInstance();
c = d.connect(url, initProps);
}
if (c != null) {
if (Boolean.parseBoolean(initProps.getProperty("readOnly"))) {
c.setReadOnly(true);
// Add other sane defaults
@ -181,13 +190,6 @@ public class JdbcDataSource extends
} else {
c.setHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT);
}
} catch (SQLException e) {
// DriverManager does not allow you to use a driver which is not loaded through
// the class loader of the class which is trying to make the connection.
// This is a workaround for cases where the user puts the driver jar in the
// solr.home/lib or solr.home/core/lib directories.
Driver d = (Driver) DocBuilder.loadClass(driver, context.getSolrCore()).newInstance();
c = d.connect(url, initProps);
}
LOG.info("Time taken for getConnection(): "
+ (System.currentTimeMillis() - start));