MariaDB To SQL Server via Connect Table Type
With rising complexity in applications, organizations are turning to heterogeneous database platforms for scalability, efficiency and cost effectiveness. This leads the database administrators to create connectivity between databases of two different platforms.
SQL server has utility of linked server which helps tremendously when it comes to configuring such inter database connectivity. MariaDB based on Linux lacks this feature but surely provides a work around for the same. Here's when table with CONNECT table type comes into picture
CONNECT uses this API to access data contained in other DBMS without having to implement a specific application for each one. It works with ODBC drivers provided by Microsoft (freeware), with drivers in place MariaDB can now connect to SQL server using the installed driver with a connection string
create table test_student ENGINE=CONNECT DEFAULT CHARSET=latin1
CONNECTION= 'Driver=/opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.790.0;
Server=<SQL_Server_name_or_ip>,<sqlserver_port>; Database=<sql_db_name>;
UID=<sql_login>; PWD=<sql_password>;' TABLE_TYPE='ODBC'
Installing the ODBC driver at MariaDB end is must for this configuration to work. the MariaDB Linux should be able to telnet to SQL database server. Now with respect to above code the MariaDB using mentioned ODBC driver will look for the table as mentioned in example "test_student" at the SQL server end specified in the connection string.
Once the query is executed it returns " table created " message. The configuration is complete. The SQL server table can be accessed from MariaDB and with rights the sql server login has on the table it can perform various dml statements. all the changes from both end can be seen to each other.
Comments
Post a Comment