sqltoolsをRedhat Linux7にインストール
Redhat Linux 7でSQLServer、SQL Databaseに接続するためのsqlcmd、bcpを使用するにはsqltoolsをインストールする。
インストール
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo
yum install mssql-tools unixODBC-devel
`
# curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 193 100 193 0 0 300 0 --:--:-- --:--:-- --:--:-- 300
# yum install mssql-tools unixODBC-devel
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
openlogic | 2.9 kB 00:00:00
packages-microsoft-com-prod | 2.9 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/3): extras/7/x86_64/primary_db | 201 kB 00:00:00
(2/3): updates/7/x86_64/primary_db | 4.2 MB 00:00:00
(3/3): packages-microsoft-com-prod/primary_db | 168 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package mssql-tools.x86_64 0:17.3.0.1-1 will be installed
--> Processing Dependency: msodbcsql17 < 17.4.0.0 for package: mssql-tools-17.3.0.1-1.x86_64
--> Processing Dependency: msodbcsql17 >= 17.3.0.0 for package: mssql-tools-17.3.0.1-1.x86_64
---> Package unixODBC-devel.x86_64 0:2.3.7-1.rh will be installed
--> Processing Dependency: unixODBC = 2.3.7 for package: unixODBC-devel-2.3.7-1.rh.x86_64
--> Running transaction check
---> Package msodbcsql17.x86_64 0:17.3.1.1-1 will be installed
---> Package unixODBC.x86_64 0:2.3.7-1.rh will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Installing:
mssql-tools x86_64 17.3.0.1-1 packages-microsoft-com-prod 254 k
unixODBC-devel x86_64 2.3.7-1.rh packages-microsoft-com-prod 42 k
Installing for dependencies:
msodbcsql17 x86_64 17.3.1.1-1 packages-microsoft-com-prod 769 k
unixODBC x86_64 2.3.7-1.rh packages-microsoft-com-prod 213 k
Transaction Summary
=============================================================================================================================================================
Install 2 Packages (+2 Dependent packages)
<中略、途中何回か確認が聞かれる>
Installed:
mssql-tools.x86_64 0:17.3.0.1-1 unixODBC-devel.x86_64 0:2.3.7-1.rh
Dependency Installed:
msodbcsql17.x86_64 0:17.3.1.1-1 unixODBC.x86_64 0:2.3.7-1.rh
Complete!
確認
# ll /opt/mssql-tools/bin/
total 760
-rwxr-xr-x. 1 root root 245464 Sep 18 2018 bcp
-rwxr-xr-x. 1 root root 531984 Sep 18 2018 sqlcmd
# /opt/mssql-tools/bin/sqlcmd -S tcp:xxxxxxxxxx-srv.database.windows.net,1433 -d tpcc -U user -P pass -N -l 30
1> SELECT name, database_id, create_date
2> FROM sys.databases ;
3> GO
name database_id create_date
-------------------------------------------------------------------------------------------------------------------------------- ----------- -----------------------
master 1 2019-05-05 01:02:23.183
tpcc 6 2019-05-12 12:19:35.517
(2 rows affected)
1>
参考
Sqlcmd および bcp、SQL Server コマンド ライン ツールを Linux にインストールします。
https://docs.microsoft.com/ja-jp/sql/linux/sql-server-linux-setup-tools?view=sql-server-2017
Author And Source
この問題について(sqltoolsをRedhat Linux7にインストール), 我々は、より多くの情報をここで見つけました https://qiita.com/mon_tu/items/9ed6305d1741c62e03d2著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .