Sql Express 2016 Unit Tests

Scott Vickers's Avatar

Scott Vickers

09 Dec, 2016 12:03 AM

Is it possible to use sql express 2016 in unit tests? We had some running on 2012 but needed some json functionality so switched to 2016 but it doesn't look like it is present. I can successfully get it working by using the sql2016 service as documented here: https://www.appveyor.com/docs/services-databases/#sql-server-2016
That means I have to change the connection string in the test when it is being run on appveyor vs. locally, not exactly sure the best way to do that.

Previously, this worked fine:

var conn = new SqlConnection("Data Source=(LocalDB)\\v11.0;Integrated Security=True;");

This does not work:

var conn = new SqlConnection("Data Source=(LocalDB)\MSSQLLocalDB;Integrated Security=true;");
  1. 1 Posted by Ilya Finkelshte... on 09 Dec, 2016 12:39 AM

    Ilya Finkelshteyn's Avatar

    Hi Scott,

    I believe that this is because couple of months ago we made a change that all MS SQL servers are stopped by default and set to use the same default port.
    This is a trade-off between ability to run different SQL versions in parallel and have all of them to have default instances with default port. Apparently majority of the customers need the later and to be able to call 127.0.0.1:1433 against each of them.
    To revert to previous settings please run this script at init stage.

    Hopefully I understood the problem correctly and this will help. Let us know if not.

    Thanks!
    Ilya.

  2. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:10 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac