Design question


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You will just do this at deployment time through the DatabaseMigrator class.  You can see a sample of this in the sample titled "Database Installer" through the sample console.  Below is some code showing how to use a different database name while using the same package file.  Be sure that your data file in your file group uses the $DbName$ tag within the DDT itself so it can create a proper file name for each database on the server....otherwise you will get an error because the file name for the file group is already in use.

Dim loDatabase As New DatabaseTargetName("MyProfileDBName")

loDatabase.NameOnServer = "MyProfileDBName_One"
_DatabaseSetup.DeployMetaData(PackageFilePathandFileName, New DatabaseTargetName() {loDatabase})

loDatabase.NameOnServer = "MyProfileDBName_Two"
_DatabaseSetup.DeployMetaData(PackageFilePathandFileName, New DatabaseTargetName() {loDatabase})

loDatabase.NameOnServer = "MyProfileDBName_Three"
_DatabaseSetup.DeployMetaData(PackageFilePathandFileName, New DatabaseTargetName() {loDatabase})

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
So what might be cool is to do this in a console app, and pass in the db name





' Main sub of a deployment console app named 'DeployDb'

Sub Main(args() As String)

'-- First argument is package path and second is database name

Dim loPackageFile As String = args(0)

Dim loDataBaseName As String = args(1)



Dim loDatabase As New DatabaseTargetName(loDataBaseName )

loDatabase.NameOnServer = "MyProfileDBName_One"

_DatabaseSetup.DeployMetaData(loPackageFile , New DatabaseTargetName() {loDatabase})

End Sub





Then you could create a batch file to update all the databases easily, even build it into the build script in VS.





:: In batch file

DeployDb "c:\data\myPackage.pkg","companyA_DbName"

DeployDb "c:\data\myPackage.pkg","companyB_DbName"

DeployDb "c:\data\myPackage.pkg","companyC_DbName"


Ben Hayat
Ben Hayat
Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)
Group: Forum Members
Posts: 374, Visits: 1.2K
Greg McGuffey (07/05/2007)
So what might be cool is to do this in a console app, and pass in the db name





' Main sub of a deployment console app named 'DeployDb'

Sub Main(args() As String)

'-- First argument is package path and second is database name

Dim loPackageFile As String = args(0)

Dim loDataBaseName As String = args(1)



Dim loDatabase As New DatabaseTargetName(loDataBaseName )

loDatabase.NameOnServer = "MyProfileDBName_One"

_DatabaseSetup.DeployMetaData(loPackageFile , New DatabaseTargetName() {loDatabase})

End Sub





Then you could create a batch file to update all the databases easily, even build it into the build script in VS.





:: In batch file

DeployDb "c:\data\myPackage.pkg","companyA_DbName"

DeployDb "c:\data\myPackage.pkg","companyB_DbName"

DeployDb "c:\data\myPackage.pkg","companyC_DbName"



Greg, I think you just earned your "Advance SF User" title! Wink

..ßen
Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
where would you tell it what SQL server/security information to use?

Keith Chisarik
Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
found it.....

Keith Chisarik
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
When you create the DatabaseMigrator class you provide the SQL server and authentication information.

_DatabaseSetup = New DatabaseMigrator(_SQLServer, False, Me, _SQLUserName, _SQLPassword)

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Keith....I'm guessing you saw Transformers BigGrin  Great movie!!!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search