Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8383019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:03:44+00:00 2026-06-09T17:03:44+00:00

I am working on a DTS SSIS package and aiming to use Teamcity buildserver

  • 0

I am working on a DTS SSIS package and aiming to use Teamcity buildserver (via Ruby / rake)… basically I want to customise for each environment (Dev, UAT, Prod) with different connection strings..

for example in Test I want to point to SQL2008Test, and in Dev SQL2008Dev. That means I’ll need to manipulate my dts package before its being deployed to the respective directory….

anyone got good experience with REXML – ruby?

This is my ruby code (with a rakefile)

config = {}
File.open(File.join(BUILD_SSIS_DIR, IRS_DSS_USER_PACKAGE)) do |config_file|
    config = REXML::Document.new(config_file)
ConfigTasks.set_dts_constring_irs config, 'ConnectionString', 
"Data Source=SQL2008DEV;Initial Catalog=IRSDEV;Provider=SQLNCLI10.1;Integrated Security=SSPI;Auto Translate=False;Application Name=SSIS-IRS DSS User Data Package-{3CC00FAB-7009-402D-AE03-2426AFC6B7ED}SQL2008 IRS Multiple Connection;"
end

and it calls

def self.set_dts_constring_irs(config_file, name, connection_string)
    conn_string_element = config_file.root.elements['DTS:ConnectionManager/DTS:Property'];
    conn_string_element['DTS:Name="ConnectionString"'] = connection_string
end

this is my DTS xml that I need to manipulate

  <DTS:ConnectionManager>
    <DTS:Property DTS:Name="DelayValidation">0</DTS:Property>
    <DTS:Property DTS:Name="ObjectName">SQL2008 IRS Multiple Connection</DTS:Property>
    <DTS:Property DTS:Name="DTSID">{3CC00FAB-7009-402D-AE03-2426AFC6B7ED}</DTS:Property>
    <DTS:Property DTS:Name="Description"></DTS:Property>
    <DTS:Property DTS:Name="CreationName">OLEDB</DTS:Property><DTS:ObjectData><DTS:ConnectionManager>
    <DTS:Property DTS:Name="Retain">0</DTS:Property>
    <DTS:Property DTS:Name="ConnectionString">Data Source=SQL2008DEV;Initial Catalog=IRSDEV;Provider=SQLNCLI10.1;Integrated Security=SSPI;Auto Translate=False;Application Name=SSIS-IRS DSS User Data Package-{3CC00FAB-7009-402D-AE03-2426AFC6B7ED}SQL2008 IRS Multiple Connection;</DTS:Property>
</DTS:ConnectionManager></DTS:ObjectData>
</DTS:ConnectionManager>

anyone got thoughts in terms of my work? e.g. how to use REXML to drill down the elements / attributes of connectionstring I need??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:03:45+00:00Added an answer on June 9, 2026 at 5:03 pm

    I am assuming you want to use REXML to find the connection string in an XML file, and to replace it with your own connection string. REXML lets you use XPath to find an element and to set it’s value:

    require 'rexml/document'
    
    # assuming:
    xml = '<DTS xmlns:DTS="www.microsoft.com/SqlServer/Dts">
             <DTS:ConnectionManager>
               <DTS:Property DTS:Name="DelayValidation">0</DTS:Property>
               <DTS:Property DTS:Name="ObjectName">SQL2008 IRS Multiple Connection</DTS:Property>
               <DTS:Property DTS:Name="DTSID">{3CC00FAB-7009-402D-AE03-2426AFC6B7ED</DTS:Property>
               <DTS:Property DTS:Name="Description"></DTS:Property>
               <DTS:Property DTS:Name="CreationName">OLEDB</DTS:Property>
               <DTS:ObjectData>
                 <DTS:ConnectionManager>
                   <DTS:Property DTS:Name="Retain">0</DTS:Property>
                   <DTS:Property DTS:Name="ConnectionString">Data Source=SQL2008DEV;Initial Catalog=IRSDEV;Provider=SQLNCLI10.1;Integrated Security=SSPI;Auto Translate=False;Application Name=SSIS-IRS DSS User Data Package-{3CC00FAB-7009-402D-AE03-2426AFC6B7ED}SQL2008 IRS Multiple Connection;</DTS:Property>
                </DTS:ConnectionManager>
               </DTS:ObjectData>
             </DTS:ConnectionManager>
           </DTS>'
    
    # find the connection string with XPath
    connection_string_xpath = '/DTS/DTS:ConnectionManager/DTS:ObjectData/DTS:ConnectionManager/DTS:Property[@DTS:Name="ConnectionString"]'
    new_connection_string = 'your new connection string here'
    
    begin
      doc = REXML::Document.new(xml)
      root = doc.root
      # check that you can find the path you are looking for
      unless root.elements[connection_string_xpath].nil?
        # set the .text of the element to your connection string:
        root.elements[connection_string_xpath].text = new_connection_string
        # test:
        puts doc
      end
    rescue REXML::ParseException => rexml_exception
      puts 'Invalid XML', rexml_exception
    end
    

    which will output (some XML removed …):

    ...
    <DTS:Property DTS:Name='ConnectionString'>your new connection string here</DTS:Property>
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had this SSIS package working yesterday and now I'm getting this error with
I have build an SSIS package which is working well within BIDS. The package
I am working on an SSIS package that uses a c# script task. For
I'm a novice, working on an SSIS package and thanks to some assistance by
Im working inside a SSIS package. I have some C# script for placing Table
We have recently migrated some 30 DTS packages in SQL Server 2000 to SSIS
Working on a Windows 8 (metro style) application, and want to reference a service
Working on dom html . I want to convert node value to string: $html
I'm running an SSIS package that I made a few months ago, and ran
I'm currently attemping to display the progress of an SSIS package that's running on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.