mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-08-06 18:24:29 +08:00
update README.md
This commit is contained in:
@ -1,6 +1,22 @@
|
||||
package ai.chat2db.server.domain.support.util;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import java.sql.Blob;
|
||||
import java.sql.Clob;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Date;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.sql.Types;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.druid.DbType;
|
||||
|
||||
import ai.chat2db.server.domain.support.enums.DataTypeEnum;
|
||||
import ai.chat2db.server.domain.support.enums.DbTypeEnum;
|
||||
import ai.chat2db.server.domain.support.enums.DriverTypeEnum;
|
||||
@ -8,19 +24,11 @@ import ai.chat2db.server.domain.support.model.DataSourceConnect;
|
||||
import ai.chat2db.server.domain.support.model.SSHInfo;
|
||||
import ai.chat2db.server.domain.support.sql.IDriverManager;
|
||||
import ai.chat2db.server.domain.support.sql.SSHManager;
|
||||
import com.alibaba.druid.DbType;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.jcraft.jsch.JSchException;
|
||||
import com.jcraft.jsch.Session;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.sql.*;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* jdbc工具类
|
||||
*
|
||||
@ -242,9 +250,10 @@ public class JdbcUtils {
|
||||
if (session != null) {
|
||||
try {
|
||||
session.delPortForwardingL(Integer.parseInt(ssh.getLocalPort()));
|
||||
session.disconnect();
|
||||
|
||||
} catch (JSchException e) {
|
||||
}
|
||||
session.disconnect();
|
||||
}
|
||||
}
|
||||
dataSourceConnect.setDescription("成功");
|
||||
|
@ -4,6 +4,8 @@
|
||||
*/
|
||||
package ai.chat2db.spi.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -68,4 +70,22 @@ public class SSHInfo {
|
||||
*/
|
||||
private String rPort;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {return true;}
|
||||
if (o == null || getClass() != o.getClass()) {return false;}
|
||||
SSHInfo sshInfo = (SSHInfo)o;
|
||||
return use == sshInfo.use && Objects.equals(hostName, sshInfo.hostName) && Objects.equals(port,
|
||||
sshInfo.port) && Objects.equals(userName, sshInfo.userName) && Objects.equals(localPort,
|
||||
sshInfo.localPort) && Objects.equals(authenticationType, sshInfo.authenticationType)
|
||||
&& Objects.equals(password, sshInfo.password) && Objects.equals(keyFile, sshInfo.keyFile)
|
||||
&& Objects.equals(passphrase, sshInfo.passphrase) && Objects.equals(rHost, sshInfo.rHost)
|
||||
&& Objects.equals(rPort, sshInfo.rPort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(use, hostName, port, userName, localPort, authenticationType, password, keyFile, passphrase,
|
||||
rHost, rPort);
|
||||
}
|
||||
}
|
@ -235,9 +235,10 @@ public class JdbcUtils {
|
||||
if (session != null) {
|
||||
try {
|
||||
session.delPortForwardingL(Integer.parseInt(ssh.getLocalPort()));
|
||||
session.disconnect();
|
||||
|
||||
} catch (JSchException e) {
|
||||
}
|
||||
session.disconnect();
|
||||
}
|
||||
}
|
||||
dataSourceConnect.setDescription("成功");
|
||||
|
Reference in New Issue
Block a user