MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.25k stars 21.41k forks source link

Not able to connect SQL Server #53960

Closed sharadrumane closed 4 years ago

sharadrumane commented 4 years ago

I have created the module and deploy to the device, but i am not able to connect to the SQL Server. is their any specific setting which i am missing? i am following the same steps which are mentioned in the tutorial.

is their any connection string related setting ? or password related setting? i am getting below error when i tried to see the logs of my sql module.

azureadmin@mneu-d-a-edge04:~$ iotedge logs sql 2020-05-04 05:53:59.07 Server Microsoft SQL Server 2017 (RTM-CU13) (KB44664 04) - 14.0.3048.4 (X64) Nov 30 2018 12:57:58 Copyright (C) 2017 Microsoft Corporation Developer Edition (64-bit) on Linux (Ubuntu 16.04.5 LTS) 2020-05-04 05:53:59.08 Server UTC adjustment: 0:00 2020-05-04 05:53:59.08 Server (c) Microsoft Corporation. 2020-05-04 05:53:59.08 Server All rights reserved. 2020-05-04 05:53:59.08 Server Server process ID is 4124. 2020-05-04 05:53:59.08 Server Logging SQL Server messages in file '/var/opt /mssql/log/errorlog'. 2020-05-04 05:53:59.08 Server Registry startup parameters: -d /var/opt/mssql/data/master.mdf -l /var/opt/mssql/data/mastlog.ldf -e /var/opt/mssql/log/errorlog 2020-05-04 05:53:59.08 Server SQL Server detected 1 sockets with 1 cores pe r socket and 2 logical processors per socket, 2 total logical processors; using 2 logical processors based on SQL Server licensing. This is an informational mes sage; no user action is required. 2020-05-04 05:53:59.09 Server SQL Server is starting at normal priority bas e (=7). This is an informational message only. No user action is required. 2020-05-04 05:53:59.09 Server Detected 6348 MB of RAM. This is an informati onal message; no user action is required. 2020-05-04 05:53:59.09 Server Using conventional memory in the memory manag er. 2020-05-04 05:53:59.12 Server Machine supports memory error recovery. SQL m emory protection is enabled to recover from memory corruption. 2020-05-04 05:53:59.28 Server Buffer pool extension is already disabled. No action is necessary. 2020-05-04 05:53:59.39 Server InitializeExternalUserGroupSid failed. Implie d authentication will be disabled. 2020-05-04 05:53:59.39 Server Implied authentication manager initialization failed. Implied authentication will be disabled. 2020-05-04 05:53:59.40 Server Successfully initialized the TLS configuratio n. Allowed TLS protocol versions are ['1.0 1.1 1.2']. Allowed TLS ciphers are [' ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM -SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256 -SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:AES256-GCM-SHA384:AES128-G CM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:!DHE-RSA-AES256-GCM- SHA384:!DHE-RSA-AES128-GCM-SHA256:!DHE-RSA-AES256-SHA:!DHE-RSA-AES128-SHA']. 2020-05-04 05:53:59.44 Server The maximum number of dedicated administrator connections for this instance is '1' 2020-05-04 05:53:59.44 Server Node configuration: node 0: CPU mask: 0x00000 00000000003:0 Active CPU mask: 0x0000000000000003:0. This message provides a des cription of the NUMA configuration for this computer. This is an informational m essage only. No user action is required. 2020-05-04 05:53:59.45 Server Using dynamic lock allocation. Initial alloc ation of 2500 Lock blocks and 5000 Lock Owner blocks per node. This is an infor mational message only. No user action is required. 2020-05-04 05:53:59.46 Server In-Memory OLTP initialized on lowend machine. 2020-05-04 05:53:59.54 Server Database Instant File Initialization: enabled . For security and performance considerations see the topic 'Database Instant Fi le Initialization' in SQL Server Books Online. This is an informational message only. No user action is required. ForceFlush is enabled for this instance. 2020-05-04 05:53:59.54 Server Query Store settings initialized with enabled = 1, 2020-05-04 05:53:59.55 spid5s Starting up database 'master'. 2020-05-04 05:53:59.57 Server Software Usage Metrics is disabled. ForceFlush feature is enabled for log durability. 2020-05-04 05:54:00.18 spid5s Resource governor reconfiguration succeeded. 2020-05-04 05:54:00.18 spid5s SQL Server Audit is starting the audits. This is an informational message. No user action is required. 2020-05-04 05:54:00.20 spid5s SQL Server Audit has started the audits. This is an informational message. No user action is required. 2020-05-04 05:54:00.38 spid5s SQL Trace ID 1 was started by login "sa". 2020-05-04 05:54:00.42 spid5s Server name is 'bc8d136d6c32'. This is an inf ormational message only. No user action is required. 2020-05-04 05:54:00.44 spid21s Always On: The availability replica manager i s starting. This is an informational message only. No user action is required. 2020-05-04 05:54:00.45 spid9s Starting up database 'mssqlsystemresource'. 2020-05-04 05:54:00.46 spid21s Always On: The availability replica manager i s waiting for the instance of SQL Server to allow client connections. This is an informational message only. No user action is required. 2020-05-04 05:54:00.48 spid5s Starting up database 'msdb'. 2020-05-04 05:54:00.48 spid9s The resource database build version is 14.00. 3048. This is an informational message only. No user action is required. 2020-05-04 05:54:00.52 spid9s Starting up database 'model'. 2020-05-04 05:54:00.75 spid19s A self-generated certificate was successfully loaded for encryption. 2020-05-04 05:54:00.76 spid19s Server is listening on [ 'any' <ipv4> 1433]. 2020-05-04 05:54:00.77 Server Server is listening on [ 127.0.0.1 <ipv4> 143 4]. 2020-05-04 05:54:00.78 Server Dedicated admin connection support was establ ished for listening locally on port 1434. 2020-05-04 05:54:00.80 spid19s SQL Server is now ready for client connection s. This is an informational message; no user action is required. 2020-05-04 05:54:01.11 spid9s Polybase feature disabled. 2020-05-04 05:54:01.11 spid9s Clearing tempdb database. 2020-05-04 05:54:02.56 spid9s Starting up database 'tempdb'. 2020-05-04 05:54:02.87 spid9s The tempdb database has 1 data file(s). 2020-05-04 05:54:02.88 spid21s The Service Broker endpoint is in disabled or stopped state. 2020-05-04 05:54:02.88 spid21s The Database Mirroring endpoint is in disable d or stopped state. 2020-05-04 05:54:02.89 spid21s Service Broker manager has started. 2020-05-04 05:54:02.93 spid5s Recovery is complete. This is an informationa l message only. No user action is required. 2020-05-04 05:56:18.66 Logon Error: 18456, Severity: 14, State: 8. 2020-05-04 05:56:18.66 Logon Login failed for user 'SA'. Reason: Password did not match that for the login provided. [CLIENT: 172.18.0.3] 2020-05-04 05:57:10.24 Logon Error: 18456, Severity: 14, State: 8. 2020-05-04 05:57:10.24 Logon Login failed for user 'SA'. Reason: Password did not match that for the login provided. [CLIENT: 172.18.0.3] 2020-05-04 05:59:02.69 spid52 Using 'dbghelp.dll' version '4.0.5' 2020-05-04 05:59:05.08 spid52 Attempting to load library 'xplog70.dll' into memory. This is an informational message only. No user action is required. 2020-05-04 05:59:05.14 spid52 Using 'xplog70.dll' version '2017.140.3048' t o execute extended stored procedure 'xp_msver'. This is an informational message only; no user action is required.

I am trying to connect my Local SQL Server by providing <Ip_address/InsatnceName> Please let me know if i am doing anything wrong.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

AshokPeddakotla-MSFT commented 4 years ago

@sharadrumane Thanks for the question. Login failed due to password mis match. Could please verfiy the sqlFunction.cs file and make sure you added the correct Connection string with correct password?

The SQL Server module comes with a default password set in the environment variables of the deployment manifest. Any time that you create a SQL Server container in a production environment, you should change the default system administrator password.

sharadrumane commented 4 years ago

@AshokPeddakotla-MSFT below is my connection string: const string str = "Data Source=tcp:sql,1433;Initial Catalog=MeasurementsDB;User Id=SA;Password=Strong!Passw0rd;TrustServerCertificate=False;Connection Timeout=30;";

it is the same connection string provided in the tutorial and i am using same password while login to my Iotedge device and i am to login as well.

I have also set Password under Environment variables for the sql module and i am not getting error for password mismatch. Only thing is happening now is data is not inserted into sqlFunction module

AshokPeddakotla-MSFT commented 4 years ago

@sharadrumane What is the result when you run /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'Strong!Passw0rd' command?

Are you able to successfully login?

AshokPeddakotla-MSFT commented 4 years ago

@sharadrumane I followed the same steps and unable to repro your issue. Please double check the steps and try again. Make sure you are able to connect SQL server with correct username and password.

sharadrumane commented 4 years ago

@AshokPeddakotla-MSFT Thanks for your reply and valuable time. i resolved the issue,SimulatedTemperatureSensor module was not sending data to edge database so i restated the module and it worked as expected so i am closing the issue.