2018-03-12 06:49:46.86 spid20s A self-generated certificate was successfully loaded for encryption. 2018-03-12 06:49:46.87 spid20s Server is listening on [ 'any' <ipv6> 1433]. 2018-03-12 06:49:46.87 spid20s Server is listening on [ 'any' <ipv4> 1433]. 2018-03-12 06:49:46.88 Server Server is listening on [ ::1 <ipv6> 1434]. 2018-03-12 06:49:46.88 Server Server is listening on [ 127.0.0.1 <ipv4> 1434]. 2018-03-12 06:49:46.89 Server Dedicated admin connection support was established for listening locally on port 1434. 2018-03-12 06:49:49.13 spid20s SQL Server is now ready for client connections. This is an informational message; no user action is required. 2018-03-12 06:49:50.24 spid9s Starting up database 'tempdb'.
次にクライアント(sqlcmd)。接続出来るまでちょっとつまづいたのでその箇所のメモ
sqlcmd: 文字コードで怒られる
1 2 3 4 5 6
// 接続 $ sqlcmd -S mssql-server -U sa -P 'xxxxxxxxxx'
// とてもエラー terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid
// 接続 $ sqlcmd -S mssql-server -U sa -P 'xxxxxxxxxx'
// とてもエラー Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Can't open lib '/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.2' : file not found.
ファイルの存在確認をしてみる
1 2 3
// あった $ ls /opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.2 /opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.2
なぜなのか。
1 2 3 4 5
// 必要そうな物は入ってるはず・・・ $ sudo ACCEPT_EULA=Y apt-get install msodbcsql mssql-tools unixodbc-dev msodbcsql is already the newest version (13.1.9.2-1). mssql-tools is already the newest version (14.0.6.0-1). unixodbc-dev is already the newest version (2.3.4-1).
[ODBC Driver 13 for SQL Server] Description=Microsoft ODBC Driver 13 for SQL Server Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.2 UsageCount=1
// ログ見てみる(長いので抜粋) $ cat /var/tmp/odbc.log [ODBC][9448][1520839365.283163][SQLSetConnectAttrW.c][606] Exit:[SQL_SUCCESS] [ODBC][9448][1520839365.283270][SQLDriverConnectW.c][290] Entry: Connection = 0x1e06d00 Window Hdl = (nil) Str In = [DRIVER={ODBC Driver 13 for SQL Server};SERVER={mssql-server};UID={sa};PWD={xxxxxxxx};WSID={9zilla};APP={SQLCMD};][length = 112 (SQL_NTS)] Str Out = (nil) Str Out Max = 0 Str Out Ptr = (nil) Completion = 0 UNICODE Using encoding ASCII 'ANSI_X3.4-1968' and UNICODE 'UCS-2LE'
[ODBC][9448][1520839365.283663][SQLConnect.c][1139]Can't open lib '/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.2' : file not found [ODBC][9448][1520839365.283694][SQLGetDiagFieldW.c][815] Entry: Connection = 0x1e06d00 Rec Number = 0 Diag Ident = 2 Diag Info Ptr = 0x7ffcb2abd65e Buffer Length = 2 String Len Ptr = (nil)
// 入れた $ sqlcmd -S mssql-server -U sa -P 'xxxxxxxxxx' 1> select name from sys.databases; 2> go name -------------------------------------------------------------------------------------------------------------------------------- master tempdb model msdb