How to set the Localdb instance name in the TeamCity plugin?

swinghouseswinghouse Posts: 120 Bronze 2
edited November 16, 2015 9:32AM in SQL CI 2
Hi,



After upgrading from SQL Server 2012 Express to 2014 Express on our build server, the TeamCity build projects that utilize the Red Gate SQL CI Build plugin, fails with the following message:
Starting LocalDB failed with error: Could not start LocalDB: Unexpected error occurred inside a LocalDB instance API method call. See the Windows Application event log for error details.
. Ensure that localDB is installed and that it is possible to start the default instance using the command 'sqllocaldb start v11.0', or specify a different temporary database server by setting the option 'temporaryDatabaseServer'

This makes sense since SQL Server 2012 was bundled with Localdb v. 11.0 and SQL Server 2014 comes with Localdb v. 12.0.

However, I can't figure out how to set the temporaryDatabaseServer option mentioned in the error message?

/Mattias

Comments

  • Hi Mattias,

    If you want to specify a particular localdb instance then you should be able to use the temporary database option in the same way you would for a regular SQL Server.

    916ALYZ.png
    Software Engineer
    Redgate Software
  • swinghouseswinghouse Posts: 120 Bronze 2
    Hi Robert,

    Thanks for the answer!

    However, after configuring my build step as per your recommendation I get another error message when I run the build in TeamCity:
    sqlCI error occurred: RedGate.Deploy.SqlServerDbPackage.Shared.Exceptions.InvalidSqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. The specified LocalDB instance does not exist.

    Connecting to LocalDB directly from SSMS on the build server with Windows credentials works fine.

    What could be the wrong?

    /Mattias
  • Hi Mattias,

    On your build agent, the tools are almost certainly being run under a system account so that might be causing issues with localdb if that was installed under a different account.

    It might be easier to use a proper SQL Server instance.
    Software Engineer
    Redgate Software
  • swinghouseswinghouse Posts: 120 Bronze 2
    Hi Robert,

    Yes, switching to a proper SQL Server instance did the trick - thank you!

    I have one minor concern with this solution: In the GUI for the TeamCity plugin, LocalDB is singled out as the recommended option.

    What's the reason behind this recommendation? Is it because LocalDB is a lightweight alternative to a full-blown SQL Server installation and thus offers a lower footprint on the build server?

    /Mattias
  • Hi Mattias,

    It's mainly for ease of setup. You don't really have to configure anything if you're using localdb. It's much easier to get started with.

    If you want more control over the temporary database or you're using functionality that localdb doesn't support, then SQL Server would be a more appropriate choice.
    Software Engineer
    Redgate Software
  • swinghouseswinghouse Posts: 120 Bronze 2
    Hi Robert,

    Thanks, I think we've covered my questions about Localdb now.

    /Mattias
Sign In or Register to comment.