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"?>
<configuration>
  <connectionStrings>
    <add name="mssql_connection" connectionString="Data Source=.;Initial Catalog=R2RMLTestDatabase;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="dotNetRDF" publicKeyToken="6055ffe4c97cc780" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.0.7.3471" newVersion="1.0.7.3471" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

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"]');
        
        if($node) 
        {
            Write-output ('Updating MSSQL ConnectionString to: ' + $mssqlConnectionString);
            $node.connectionString = $mssqlConnectionString;    
        }
        
        $doc.Save($o.FullName);
    }
    
    
}

$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:
https://ci.appveyor.com/project/mchaloupka/dotnetr2rmlstore/build/0...

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

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

Recent Discussions

23 Jan, 2019 06:22 PM
23 Jan, 2019 11:15 AM
23 Jan, 2019 07:15 AM
22 Jan, 2019 08:41 PM
22 Jan, 2019 08:28 PM