diff --git a/packages/plugins/package.json b/packages/plugins/package.json index e6d65a3b1ad9..858955ba26f1 100644 --- a/packages/plugins/package.json +++ b/packages/plugins/package.json @@ -14,7 +14,8 @@ "mysql2": "^3.11.3", "json5": "^2.2.3", "pg": "^8.10.0", - "wikijs": "^6.4.1" + "wikijs": "^6.4.1", + "dmdb":"^1.0.0" }, "devDependencies": { "@fastgpt/global": "workspace:*", diff --git a/packages/plugins/src/databaseConnection/index.ts b/packages/plugins/src/databaseConnection/index.ts index 67cf709517bc..70aceb32d4ae 100644 --- a/packages/plugins/src/databaseConnection/index.ts +++ b/packages/plugins/src/databaseConnection/index.ts @@ -1,7 +1,7 @@ import { Client as PgClient } from 'pg'; // PostgreSQL 客户端 import mysql from 'mysql2/promise'; // MySQL 客户端 import mssql from 'mssql'; // SQL Server 客户端 - +import dmdb from 'dmdb'; //达梦数据库 type Props = { databaseType: string; host: string; @@ -67,6 +67,17 @@ const main = async ({ result = await pool.query(sql); await pool.close(); + }else if ( databaseType === 'dmdb' ){ + const connInfo = { + connectString: `${host}:${parseInt(port, 10)}`, + user: user, + password: password, + loginEncrypt: false, + ignoreCase: true + } + const connection = await dmdb.getConnection(connInfo) + result = await connection.execute(sql); + await connection.close(); } return { result diff --git a/packages/plugins/src/databaseConnection/template.json b/packages/plugins/src/databaseConnection/template.json index cd0627bdad61..4e456f3e8b02 100644 --- a/packages/plugins/src/databaseConnection/template.json +++ b/packages/plugins/src/databaseConnection/template.json @@ -46,6 +46,10 @@ { "label": "Microsoft SQL Server", "value": "Microsoft SQL Server" + }, + { + "label": "dmdb", + "value": "dmdb" } ], "required": true diff --git a/projects/app/.env.template b/projects/app/.env.template index d321bc86af64..27b6f97828fc 100644 --- a/projects/app/.env.template +++ b/projects/app/.env.template @@ -63,4 +63,6 @@ CHECK_INTERNAL_IP=false # # 日志来源ID前缀 # CHAT_LOG_SOURCE_ID_PREFIX=fastgpt- # 自定义跨域,不配置时,默认都允许跨域(逗号分割) -ALLOWED_ORIGINS= \ No newline at end of file +ALLOWED_ORIGINS= +# 允许使用旧版加密算法 (达梦数据库连接时需要) +NODE_OPTIONS=--openssl-legacy-provider \ No newline at end of file