【问题标题】:Error inserting into database with Node.JS and SQL Server Always Encrypted使用 Node.JS 和 SQL Server Always Encrypted 插入数据库时​​出错
【发布时间】:2018-05-27 03:24:26
【问题描述】:

我使用具有 Always Encrypted 功能的 SQL Server 数据库。当我尝试插入一行时,它会失败并抛出错误

let request = new Request(`INSERT INTO [dbo].[table_name] ([Name])
                           VALUES ('test')`,
                function (err, rowCount, rows) {
                    if (err) {
                        console.log('errr--', err);
                    } else {
                        console.log(' row(s) ', rows);
                    }
                });

错误:

RequestError:操作数类型冲突:varchar 与使用 (encryption_type = 'DETERMINISTIC',encryption_algorithm_name = 'AEAD_AES_256_CBC_HMAC_SHA_256',column_encryption_key_name = 'CEK_Auto1',column_encryption_key_database_name = 'Drugstore_DB') 加密的 varchar(8000) 不兼容 collat​​ion_name = 'CIAS'CPLatin_1 ```

问题出在哪里?

【问题讨论】:

    标签: sql-server node.js azure encryption always-encrypted


    【解决方案1】:

    AlwaysEncrypted 是客户端加密,因此必须由您的客户端驱动程序支持。 AFAIK 目前已实现 AlwaysEncrypted 的客户端库列表是:

    -用于 .NET Framework(但不是 .NET Core/.NET Standard)的SqlClient

    -Microsoft ODBC Driver for SQL Server for Windows

    -Microsoft ODBC Driver for SQL Server for Linux

    -Microsoft JDBC Driver for SQL Server

    【讨论】:

    • 我们是否使用 JDBC‌ 将 NodeJS 应用程序连接到 SQL?
    • 更有可能有一个使用 Node.js 中的 ODBC 的包。
    猜你喜欢
    • 1970-01-01
    • 2018-07-13
    • 2017-10-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多