Skip to content

Commit 248f99b

Browse files
committed
If the database name contains the name of the current database, the current database is placed in the first place
1 parent 31b0b34 commit 248f99b

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

chat2db-server/chat2db-spi/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
<artifactId>jsch</artifactId>
3737
<version>0.2.9</version>
3838
</dependency>
39+
<dependency>
40+
<groupId>org.bouncycastle</groupId>
41+
<artifactId>bcprov-jdk18on</artifactId>
42+
<version>1.71</version>
43+
</dependency>
3944
<dependency>
4045
<groupId>com.oracle.ojdbc</groupId>
4146
<artifactId>orai18n</artifactId>

chat2db-server/chat2db-spi/src/main/java/ai/chat2db/spi/ssh/SSHManager.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11

22
package ai.chat2db.spi.ssh;
33

4+
import java.security.Security;
5+
46
import ai.chat2db.server.tools.common.exception.ConnectionException;
57
import ai.chat2db.spi.model.SSHInfo;
68
import cn.hutool.core.net.NetUtil;
79
import cn.hutool.extra.ssh.JschUtil;
10+
import com.jcraft.jsch.JSch;
811
import com.jcraft.jsch.Session;
912
import lombok.extern.slf4j.Slf4j;
1013
import org.apache.commons.lang3.StringUtils;
14+
import org.bouncycastle.jce.provider.BouncyCastleProvider;
1115

1216
/**
1317
* @author jipengfei
@@ -16,6 +20,16 @@
1620
@Slf4j
1721
public class SSHManager {
1822

23+
static {
24+
try {
25+
Security.insertProviderAt(new BouncyCastleProvider(), 1);
26+
JSch.setConfig("kex", JSch.getConfig("kex") + ",diffie-hellman-group1-sha1");
27+
JSch.setConfig("server_host_key", JSch.getConfig("server_host_key") + ",ssh-rsa,ssh-dss");
28+
}catch (Exception e){
29+
log.error("SSHManager init error",e);
30+
}
31+
}
32+
1933
public static Session getSSHSession(SSHInfo ssh) {
2034
Session session = null;
2135
try {

0 commit comments

Comments
 (0)