mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@445 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -203,12 +203,14 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
SQLException connectError = null;
|
||||
|
||||
try {
|
||||
// 初始化连接
|
||||
for (int i = 0, size = getInitialSize(); i < size; ++i) {
|
||||
Connection conn = connectionFactory.createConnection();
|
||||
conn.setAutoCommit(true);
|
||||
connections[count++] = new ConnectionHolder(this, conn);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
LOG.error("init datasource error", ex);
|
||||
connectError = ex;
|
||||
}
|
||||
|
||||
@@ -230,7 +232,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
createdTime = new Date();
|
||||
instances.put(this, PRESENT);
|
||||
|
||||
if (connectError != null) {
|
||||
if (connectError != null && count == 0) {
|
||||
throw connectError;
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
Reference in New Issue
Block a user