none
How do i update a database after modifying the connection? RRS feed

  • Question

  • Based on add-a-data-source-to-tabular-model-analysis-services-amo-tom

    i am trying to update the Database connectionstring changes:

    Import-Module SqlServer
    
    $newConnectionString = "Connection Timeout=60;User Id=SOME_NEW_ID;Data Source=10.10.19.10;Persist Security Info=True;Session Character Set=UTF8"
    
     $svr = new-Object Microsoft.AnalysisServices.Tabular.Server
    $svr.Connect("server1.domain.com")
    
    $svr.databases[1].model.datasources[0].ConnectionString = $newConnectionString
    $svr.Databases[1].model.datasources[0].Update(UpdateOptions.ExpandFull)

    But i am getting errors:

    Unexpected token 'UpdateOptions.ExpandFull' in expression or statement.

    if i do regular Update():

    $svr.Databases[1].model.datasources[0].Update()

    i get this:

    Method invocation failed because [Microsoft.AnalysisServices.Tabular.ProviderDataSource] does not contain a method named 'Update'

    and if i try SaveChanges():

    $svr.Databases[1].Model.SaveChanges()
    I get this error:

    The following exception occurred while retrieving member "SaveChanges": "Encountered an invalid type for a default value."


    • Moved by jrv Sunday, November 11, 2018 3:09 AM Best forum
    Sunday, November 11, 2018 2:54 AM

Answers

  • Have you updated the SQLServer module?

    \_(ツ)_/

    i figured it out!

    $svr.Databases[1].Update([Microsoft.AnalysisServices.UpdateOptions]::ExpandFull)

    Sunday, November 11, 2018 6:37 PM

All replies