|
@@ -11,6 +11,7 @@ import javax.sql.DataSource;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.commons.exception.ExamCloudRuntimeException;
|
|
|
import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
|
|
|
import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
|
|
|
|
|
@@ -46,9 +47,21 @@ public class DBUtil {
|
|
|
public static DataSource initDataSource(final String dataSourceName) {
|
|
|
Class<?> c = null;
|
|
|
try {
|
|
|
- c = Class.forName("com.mchange.v2.c3p0.ComboPooledDataSource");
|
|
|
+ c = Class.forName("com.alibaba.druid.pool.DruidDataSource");
|
|
|
} catch (ClassNotFoundException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
+ // ignore
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == c) {
|
|
|
+ try {
|
|
|
+ c = Class.forName("com.mchange.v2.c3p0.ComboPooledDataSource");
|
|
|
+ } catch (ClassNotFoundException e) {
|
|
|
+ // ignore
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == c) {
|
|
|
+ throw new ExamCloudRuntimeException("no class about dataSource implementation.");
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|