2023年5月18日12:26:54

master
zhangmeng 2023-05-18 12:26:59 +08:00
parent 99439aaf68
commit db2423961a
1 changed files with 12 additions and 17 deletions

View File

@ -104,7 +104,7 @@ public class SqlQueryController {
String sql = query_area.getSelectedText(); String sql = query_area.getSelectedText();
if (is_exchange.get()){ if (is_exchange.get()) {
connection(); connection();
} }
@ -122,11 +122,11 @@ public class SqlQueryController {
for (Map.Entry<String, Object> entry : map1.entrySet()) { for (Map.Entry<String, Object> entry : map1.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
if (key.equals("unique_identification_key")){ if (key.equals("unique_identification_key")) {
continue; continue;
} }
if (key.equals("now_pos")){//now_pos -> null if (key.equals("now_pos")) {//now_pos -> null
continue; continue;
} }
@ -151,20 +151,15 @@ public class SqlQueryController {
public void getJdbcTemplate() { public void getJdbcTemplate() {
jdbcTemplate = new JdbcTemplate();
if (jdbcTemplate == null) { DruidDataSource datasource = new DruidDataSource();
jdbcTemplate = new JdbcTemplate(); String url = "jdbc:mysql://" + ip.getText() + ":" + port.getText() + "/" + database.getText() + "?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true";
String driverClassName = "com.mysql.jdbc.Driver";
DruidDataSource datasource = new DruidDataSource(); datasource.setUrl(url);
String url = "jdbc:mysql://" + ip.getText() + ":" + port.getText() + "/" + database.getText() + "?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true"; datasource.setUsername(username.getText());
String driverClassName = "com.mysql.jdbc.Driver"; datasource.setPassword(password.getText());
datasource.setUrl(url); datasource.setDriverClassName(driverClassName);
datasource.setUsername(username.getText()); jdbcTemplate.setDataSource(datasource);
datasource.setPassword(password.getText());
datasource.setDriverClassName(driverClassName);
jdbcTemplate.setDataSource(datasource);
}
} }
public void connection() { public void connection() {