liwh месяцев назад: 7
Родитель
Сommit
982757fc3d

+ 9 - 1
cql-service/src/main/java/cn/com/taiji/cql/service/impl/BuildDataStoreImpl.java

@@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.geotools.api.data.DataStore;
 import org.geotools.data.jdbc.datasource.DBCPDataSourceFactory;
 import org.geotools.data.jdbc.datasource.DataSourceFinder;
+import org.geotools.data.jdbc.datasource.DataSourceUtil;
 import org.geotools.data.mysql.MySQLDataStoreFactory;
 import org.geotools.jdbc.JDBCDataStoreFactory;
 import org.springframework.stereotype.Service;
@@ -46,7 +47,14 @@ public class BuildDataStoreImpl implements IBuildDataStore {
         }else{
 
 
-            DataSource dataSource = DataSourceFinder.getDataSource(mapParams);
+            String url = mapParams.get(DBCPDataSourceFactory.JDBC_URL.key).toString();
+            String driverName=mapParams.get(DBCPDataSourceFactory.DRIVERCLASS.key).toString();
+            String username=mapParams.get(DBCPDataSourceFactory.USERNAME.key).toString();
+            String password=mapParams.get(DBCPDataSourceFactory.PASSWORD.key).toString();
+            String validationQuery="SELECT 1";
+
+
+            DataSource dataSource = DataSourceUtil.buildDefaultDataSource(url,driverName,username,password,validationQuery);
 
             if(dataSource !=null){