Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    Copy Database Connections over Database connections ?

    Scheduled Pinned Locked Moved Support
    buildmaster
    10 Posts 3 Posters 20 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      pcamelio_0469
      last edited by

      Hello
      I am looking a way to duplicate several database connections over multiple applications.
      Is there any way to do it ?

      Another question,

      • it is possible to define a database connection based on variable like this way :
      
      Connection Name : $ConnectionName
      Server : $DBServer
      Connection String : Server=$ApplicationName$PipelineStageName.SQL.$DomaineName\$ApplicationName$PipelineStageName;Integrated Security=true;
      

      Best Regards

      Product: BuildMaster
      Version: 6.1.5

      1 Reply Last reply Reply Quote 0
      • jjonesJ Offline
        jjones inedo-engineer
        last edited by

        Hi Philippe,

        You should be able to use a System Variable (administration/variables) to store the connection string that you want to use over multiple applications.

        Also,
        Yes. you can define a connection string as per your example.

        Does this help?

        Thanks,
        Jason

        1 Reply Last reply Reply Quote 0
        • ? This user is from outside of this forum
          Guest
          last edited by

          A lot :)

          I ll make a try

          Thanks a lot

          1 Reply Last reply Reply Quote 0
          • ? This user is from outside of this forum
            Guest
            last edited by

            I made a try of the SQL string based on variable and it is not working :(

            1 Reply Last reply Reply Quote 0
            • jjonesJ Offline
              jjones inedo-engineer
              last edited by

              Philippe,

              You will need to use variable value renderers to accomplish this.

              then value render text will be your string i.e. Server=$ApplicationName$PipelineStageName.SQL.$DomaineName\$ApplicationName$PipelineStageName;Integrated Security=true;

              then you can reference that variable in your application by adding it as a release variable or build variable.

              1 Reply Last reply Reply Quote 0
              • ? This user is from outside of this forum
                Guest
                last edited by

                Jason

                I am a silly sysadmin and not smart like a dev gu :-)

                I can't make it works.

                I define a variable value renderer:

                Variable : $SQLString
                Scope : AppsGroup
                Value:$ApplicationName$PipelineStageName.SQL.$DomaineName\$ApplicationName$PipelineStageName;Integrated Security=true;
                

                In the Application, I set a release variable $MySQLString to $SQLString

                In the DatabaseConnection, I created a new DB connection and set the Connection DB string to $MySQLString.

                I got this error msg:

                Unhandled exception: System.ArgumentException: Le format de la chaîne d'initialisation n'est pas conforme à la spécification qui débute à l'index 0.
                   à System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue)
                   à System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey)
                   à System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules)
                   à System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
                   à System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
                   à System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
                   à System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)
                   à System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
                   à System.Data.SqlClient.SqlConnection..ctor(String connectionString, SqlCredential credential)
                   à Inedo.BuildMasterExtensions.SqlServer.SqlServerDatabaseProvider.<GetConnectionAsync>d__15.MoveNext()
                --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
                   à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                   à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                   à Inedo.BuildMasterExtensions.SqlServer.SqlServerDatabaseProvider.<ExecuteQueryAsync>d__14.MoveNext()
                --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
                   à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                   à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                   à Inedo.BuildMaster.DatabaseConnections.ExecuteDatabaseScriptsJob.<ExecuteAsync>d__8.MoveNext()
                --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
                   à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                   à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                   à Inedo.Agents.AgentCommand`1.<Inedo-Agents-IAgentCommandWithResponse-ExecuteAsync>d__5.MoveNext()
                --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
                   à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                   à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                   à Inedo.Agents.AgentCommandDispatcher.<ExecuteCommandAsync>d__5.MoveNext()
                ``
                1 Reply Last reply Reply Quote 0
                • jjonesJ Offline
                  jjones inedo-engineer
                  last edited by

                  Hi Philippe,

                  When you add the Release variable does it appear to have the correct connection string on the page? I'm going to try and replicate this error on my end but want to make sure the rendering is working first.

                  Thanks,
                  Jason

                  1 Reply Last reply Reply Quote 0
                  • ? This user is from outside of this forum
                    Guest
                    last edited by

                    It resolves the value, but as there is a value which depend on the pipeline name, a part is missing.

                    Variable : $SQLString
                    Scope : AppsGroup
                    Value:$ApplicationName$PipelineStageName.SQL.$DomaineName\$ApplicationName$PipelineStageName;Integrated Security=true;
                    
                    Release variable:
                    SQLString
                    
                    Display Value : APPLI.SQL.LOCAL.LAN\APPLI
                    ``
                    For each Pipeline step (3 steps DEV, QA, PRD for example), I should have the following DB connection:
                    
                    * APPLIDEV.SQL.LOCAL.LAN\APPLIDEV
                    * APPLIQA.SQL.LOCAL.LAN\APPLIQA
                    * APPLIPRD.SQL.LOCAL.LAN\APPLIPRD
                    
                    Setting the variable $SQLString at the pipeline level give nothing.
                    1 Reply Last reply Reply Quote 0
                    • jjonesJ Offline
                      jjones inedo-engineer
                      last edited by

                      Hi Philippe,

                      I see that the $PiplineStageName is not available at the Release level. So this will only work as a Build variable.

                      Does this help?

                      Thanks!
                      Jason

                      1 Reply Last reply Reply Quote 0
                      • ? This user is from outside of this forum
                        Guest
                        last edited by

                        You are right, the PipelinestageName Variable is correctly set at the build level..

                        But, it is assigned with the last Pipeline used and it is a little confusing for what I am looking for (for each pipeline step correspond a DB string)

                        Never mind, I will make the DB connection by hand

                        Thank you for the spending time

                        1 Reply Last reply Reply Quote 0

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • 1 / 1
                        • First post
                          Last post
                        Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation