I am not able to configure the connection string properly

Miloš Chaloupka's Avatar

Miloš Chaloupka

07 May, 2015 02:23 PM

I am trying to use SQL 2014 in my test suite. It is working correctly on my local computer and I am now trying to get it working here.

The app.config for the test project:

<?xml version="1.0" encoding="utf-8"?>
    <add name="mssql_connection" connectionString="Data Source=.;Initial Catalog=R2RMLTestDatabase;Integrated Security=True" providerName="System.Data.SqlClient" />
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <assemblyIdentity name="dotNetRDF" publicKeyToken="6055ffe4c97cc780" culture="neutral" />
        <bindingRedirect oldVersion="" newVersion="" />

Using a powershell script before test, I am updating the connection string to "Data Source=(local)\SQL2014;Initial Catalog=R2RMLTestStore;Integrated Security=True" (I have also tried the connection strings from your help, but it was the same). See the before test script:

$sqlInstance = "(local)\SQL2014";
$dbName = "R2RMLTestStore";

function Update-Config 
    $mssqlConnectionString = "Data Source=$sqlInstance;Initial Catalog=$dbName;Integrated Security=True";
    foreach($o in $input) 
        Write-output ('Updating ' + $o.FullName)
        $doc = (Get-Content $o.FullName) -as [xml];
        $node = $doc.SelectSingleNode('//connectionStrings/add[@name="mssql_connection"]');
            Write-output ('Updating MSSQL ConnectionString to: ' + $mssqlConnectionString);
            $node.connectionString = $mssqlConnectionString;    

$env:APPVEYOR_BUILD_FOLDER | get-childitem -recurse |? {$_.Name -eq "app.config"} | Update-Config;

Write-output ('Creating database ' + $dbName);
sqlcmd -S "$sqlInstance" -Q "Use [master]; CREATE DATABASE [$dbName]";

However, I am getting the exception when I try to connect using the connection string. See build result:

Am I doing something wrong? Am I missing something? Thanks for your reply.

  1. Support Staff 1 Posted by Feodor Fitsner on 07 May, 2015 05:05 PM

    Feodor Fitsner's Avatar

    Well, make sure that C:\projects\dotnetr2rmlstore\src\Slp.r2rml4net.Storage\Slp.r2rml4net.Test.Unit\bin\Release\Slp.r2rml4net.Test.Unit.dll.config has correct connection string.

  2. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:56 AM.

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

Keyboard shortcuts


? 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