0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

sqlserver 接続方法についてのまとめ

Last updated at Posted at 2020-04-23

現在の接続がどのプロトコルで接続されているかの確認。

>sqlcmd -U sa -P insight -S (local)\MSSQLSERVER01
1> SELECT net_transport
2> FROM sys.dm_exec_connections
3> WHERE session_id = @@SPID;
4> go

net_transport
----------------------------------------
Shared memory

明示的にTCPを指定した場合はTCPで接続される。

>sqlcmd -U sa -P insight -S tcp:(local)\MSSQLSERVER01
1> SELECT net_transport
2> FROM sys.dm_exec_connections
3> WHERE session_id = @@SPID;
4> go
net_transport
----------------------------------------
TCP

現在のセッションがどのプロトコルで接続されているか、やどのポートから接続されているか確認するクエリ。

select * from sys.dm_exec_connections;

51	51	2020-01-20 09:17:52.000	Shared memory	TSQL	1946157060	2	FALSE	NTLM	0	9	9	2020-01-20 09:17:52.080	2020-01-20 09:17:52.087	8000	<local machine>	NULL	NULL	NULL	9EB1E46A-F255-40DB-97C3-CBCA68FDC617	NULL	0x0100010041F2D011B0C89EA5A101000000000000000000000000000000000000000000000000000000000000
52	52	2020-01-20 08:44:40.620	Shared memory	TSQL	1946157060	2	FALSE	SQL	0	18	17	2020-01-20 09:20:46.563	2020-01-20 09:20:46.560	4096	<local machine>	NULL	NULL	NULL	EAB14B05-C5BD-421E-A260-F5B36E26C70A	NULL	0x02000000123E7E259491A4FADE9B1FD9C67F6C92519C5B3D0000000000000000000000000000000000000000
53	53	2020-01-20 08:53:32.870	TCP	TSQL	1946157060	4	FALSE	SQL	0	7	7	2020-01-20 08:53:57.423	2020-01-20 08:53:57.427	4096	172.20.21.32	59893	192.168.100.6	49764	F67AD448-35EC-43C9-A69C-910CFBEB4DC6	NULL	0x02000000BB8CB316E68ED5E40AA8947D6AC94641D6F1B8770000000000000000000000000000000000000000
54	54	2020-01-20 09:16:20.537	TCP	TSQL	1895825409	4	FALSE	SQL	0	18	18	2020-01-20 09:16:20.560	2020-01-20 09:16:20.560	4096	192.168.100.6	50461	192.168.100.6	49764	5B7133FF-A5C7-4E9E-A4AE-150616EB2146	NULL	0x02000000195F78313A29A5559ED8CA53CB2EF8A0E53F8B070000000000000000000000000000000000000000

その他SQLServer へのログイン方法は以下を参考に行う。

参考サイト
https://docs.microsoft.com/ja-jp/sql/database-engine/configure-windows/logging-in-to-sql-server?view=sql-server-ver15

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?