连接ClickHouse数据库报错 返回

SqlSugar
774
该叫什么 Cube 发布于2026/1/5
悬赏:0 飞吻

SqlSugarCore版本:5.1.4.208-preview06;

SqlSugar.ClickHouseCore版本:5.1.4.201


代码:


            var connStr = "Host=1.1.1.1;Port=100;Database=dm;User=test;password=test@5tgb;UseSsl=true;SslMode=NONE";

            

            _sqlSugerClient = new SqlSugarClient(new ConnectionConfig

            {

                DbType = DbType.ClickHouse,

                ConnectionString = connStr,

                IsAutoCloseConnection = true,

                InitKeyType = InitKeyType.Attribute,

                AopEvents = new AopEvents

                {

                    OnLogExecuting = (sql, p) =>

                    {

                        Console.WriteLine(sql);

                        Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value)));

                    }

                }

            });


报错信息:

操作失败,请检查日志:One or more errors occurred. (中文提示 :  连接数据库过程中发生错误,检查服务器是否正常连接字符串是否正确,错误信息:<html>\r\n<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n<center>The plain HTTP request was sent to HTTPS port</center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\nDbType=\"ClickHouse\";ConfigId=\"\".\r\nEnglish Message : Connection open error . <html>\r\n<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n<center>The plain HTTP request was sent to HTTPS port</center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\nDbType=\"ClickHouse\";ConfigId=\"\" )


这是数据库的jdbc连接字符串:jdbc:clickhouse://1.1.1.1:100/dm?user=test&password=test@5tgb&ssl=true&sslmode=NONE

使用dbeaver数据库连接工具,输入jdbc连接字符串是能够正常连接的,但是通过SqlSuger就一直报错,是不是和【ssl=true&sslmode=NONE】这部分连接字符串有关系呢?这部分字符串在SqlSuger中应该如果写呢?


热忱回答(0)