I am having error while connecting to SQL Server:
Details in Stack Trace are:
===================================
Cannot connect to ServerN
SQL 2016 solution/workaround here (could also work in earlier versions). This may not work or be appropriate in every situation, but I resolved the error by granting my database user read/write schema ownership as follows in SSMS:
Database > Security > Users > User > Properties > Owned Schemas > check db_datareader and db_datawriter.