• 【MySQL】MariaDB使用connect存储引擎访问SQLServer中的表


    借助connect存储引擎,Mariadb可以访问任何ODBC数据源。
    本文是以CentOS7为例。安装的内容有:ODBC driver,unixODBC

    1.下载ODBC对应linux的驱动
    下载地址:

    https://docs.microsoft.com/en-us/sql/connect/odbc/microsoft-odbc-driver-for-sql-server?view=sql-server-ver16

    2.使用提供的脚本build_dm.sh安装unixODBC

    bash build_dm.sh
    ....
    The script is provided as a convenience to you as-is, without any express
    or implied warranties of any kind.  Microsoft is not liable for any issues
    arising out of your use of the script.
    
    Enter 'YES' to have this script continue: YES
    
    Verifying processor and operating system ................................... OK
    Verifying wget is installed ................................................ OK
    Verifying tar is installed ................................................. OK
    Verifying make is installed ................................................ OK
    Downloading unixODBC 2.3.0 DriverManager ................................... OK
    Unpacking unixODBC 2.3.0 DriverManager ..................................... OK
    Configuring unixODBC 2.3.0 DriverManager ................................... OK
    Building unixODBC 2.3.0 DriverManager ...................................... OK
    Build of the unixODBC 2.3.0 DriverManager complete.
    
    Run the command 'cd /tmp/unixODBC.32235.28222.16428/unixODBC-2.3.0; make install' to install the driver manager.
    

    然后安装

    cd /tmp/unixODBC.32235.28222.16428/unixODBC-2.3.0; make install
    

    如果发生依赖失败,可以执行:

    yum install yum-utils && yum-builddep unixODBC

    如果yum安装的是最新的包,驱动有可能失败。

    3.安装MSSQL包

    bash install.sh install
    

    接受协议

    Enter YES to accept the license or anything else to terminate the installation: YES
    
    Checking for 64 bit Linux compatible OS ..................................... OK
    Checking required libs are installed ................................. NOT FOUND
    unixODBC utilities (odbc_config and odbcinst) installed ............ NOT CHECKED
    unixODBC Driver Manager version 2.3.0 installed .................... NOT CHECKED
    unixODBC Driver Manager configuration correct ...................... NOT CHECKED
    Microsoft SQL Server ODBC Driver V1.0 for Linux already installed .. NOT CHECKED
    Microsoft SQL Server ODBC Driver V1.0 for Linux files copied ................ OK
    Symbolic links for bcp and sqlcmd created ................................... OK
    Microsoft SQL Server ODBC Driver V1.0 for Linux registered ........... INSTALLED
    

    也可以通过yum install unixODBC安装或更新。

    可以通过/etc/odbcinst.ini查看MSSQL包是否存在。

    4.安装connect引擎
    在服务器上执行:

    yum install MariaDB-connect-engine

    登录mariadb执行:

    INSTALL SONAME 'ha_connect.so';
    

    5.创建表
    根据文件/etc/odbcinst.ini的信息创建表:

    CREATE TABLE mssql_table ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='Driver=SQL Server Native Client 11.0;Server=ms-sql01;Database=old_version_migration_data;UID=mariadb;PWD=password' `TABLE_TYPE`='ODBC'
    

    https://mariadb.com/resources/blog/getting-microsoft-sql-server-data-into-mariadb-with-the-connect-storage-engine/

  • 相关阅读:
    SPOJ ORDERSET
    BZOJ 1109: [POI2007]堆积木Klo
    BZOJ 1112: [POI2008]砖块Klo
    BZOJ 4144: [AMPPZ2014]Petrol
    BZOJ 4385: [POI2015]Wilcze doły
    BZOJ 1124: [POI2008]枪战Maf
    BZOJ 1123: [POI2008]BLO
    BZOJ 1121: [POI2008]激光发射器SZK
    BZOJ 1131: [POI2008]Sta
    BZOJ 4551: [Tjoi2016&Heoi2016]树
  • 原文地址:https://www.cnblogs.com/abclife/p/16639131.html
Copyright © 2020-2023  润新知