If the database name contains the name of the current database, the current database is placed in the first place

This commit is contained in:
jipengfei-jpf
2023-08-07 22:48:48 +08:00
parent 31b0b343f0
commit 248f99b464
2 changed files with 19 additions and 0 deletions

View File

@ -36,6 +36,11 @@
<artifactId>jsch</artifactId>
<version>0.2.9</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.71</version>
</dependency>
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>orai18n</artifactId>

View File

@ -1,13 +1,17 @@
package ai.chat2db.spi.ssh;
import java.security.Security;
import ai.chat2db.server.tools.common.exception.ConnectionException;
import ai.chat2db.spi.model.SSHInfo;
import cn.hutool.core.net.NetUtil;
import cn.hutool.extra.ssh.JschUtil;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
/**
* @author jipengfei
@ -16,6 +20,16 @@ import org.apache.commons.lang3.StringUtils;
@Slf4j
public class SSHManager {
static {
try {
Security.insertProviderAt(new BouncyCastleProvider(), 1);
JSch.setConfig("kex", JSch.getConfig("kex") + ",diffie-hellman-group1-sha1");
JSch.setConfig("server_host_key", JSch.getConfig("server_host_key") + ",ssh-rsa,ssh-dss");
}catch (Exception e){
log.error("SSHManager init error",e);
}
}
public static Session getSSHSession(SSHInfo ssh) {
Session session = null;
try {