[database2]
db_enable=1
db_type=SQLServer
db_user=sa
db_passwd=tn1234
db_port=1433
default_db=tn_iot
db_pool_size=10
db_ip=192.168.1.1
max_count=100000
date_format=0
one_fetch_count=1000
Trusted_Connection=0
db_mm=123456
bcp_path=
use_bcp=0

[database3]
db_enable=1
db_type=MySQL
db_user=root
db_passwd=123
db_port=3306
default_db=machdata
db_pool_size=3
db_ip=192.168.6.220
max_count=100000
date_format=0
one_fetch_count=1000
Trusted_Connection=0
db_mm=123456
bcp_path=
use_bcp=0
enable_to_gbk=0
db_driver=MySQL ODBC 8.0 ANSI Driver
db_dsn=Driver={MySQL ODBC 8.0 ANSI Driver};Server=192.168.6.220;Database=machdata;Uid=root;Pwd=123;

注意:密码中不能有@符号

使用MySQL的时候,需要提前安装MySQL的ODBC驱动, 安装MySQL驱动需要提前安装vs++2015 运行库

[MySQL ODBC下载]: https://dev.mysql.com/downloads/connector/odbc/ "下载第一个Windows (x86, 32-bit), MSI Installer"

[VS++2015运行库下载]: http://download.fixdown.com/soft/vcredist2015.exe


function DB2select(sql, sParam, help)
    help:reset();
    local dbx = CDBLuaProcess();
    if dbx:getDB2() == false then
        outIt:set('code','-1');
        outIt:set('error', 'DB2数据库连接失败');
        return -1;
    elseif dbx:select(sql, sParam, help) < 0 then
        outIt:set('code','-1');
        outIt:set('error', dbx:error());
        dbx:unlock2();
        return -1;
    else
        dbx:unlock2();
        return help:size();
    end
end

function DB2execSQL(sql, sParam)
    local dbx = CDBLuaProcess();
    if dbx:getDB2() == false then
        outIt:set('code','-1');
        outIt:set('error', '数据库连接失败');
        return false;
    elseif dbx:execSQL(sql,'') == false then 
        outIt:set('code','-1');
        outIt:set('error', dbx:error());
        dbx:unlock2();
        return false;
    else
        dbx:unlock2();
        return true;
    end
end
Copyright © TouchNet 2015 all right reserved,powered by Gitbook最后修订时间: 2022-06-21 09:21:06

results matching ""

    No results matching ""