DDT NameOnServer not working


Author
Message
Randy Jean
Randy Jean
StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
I'm so close to having my deployment issues resolved I can taste it, however,I have one nagging problem that I can't seem to figure out. I need to be able to maintain 2 separate SQLExpress local databases, test and live. I have separate locations set for the connection.dat files, etc. The only thing I can't seemt to get to work is creating a database with a different name than what is in my DDT profile. I step in and see that indeed NameOnServer property is getting set to "MyLocalDBTest" but it just keeps updating updating MyLocalDB and never creates the test database. Any ideas?







Dim _DatabaseSetup as New SQL.DatabaseMigrator



Dim loDatabase As New DatabaseTargetName("MyLocalDb")



loDatabase.NameOnServer = CStr(IIf(MyApp.AppMain._TestEnv, "MyLocalDbTest", "MyLocalDb"))



' using NT auth, no user/password

_DatabaseSetup = New DatabaseMigrator("MyServer", True, Me)



_DatabaseSetup.EnableLogging = True

_DatabaseSetup.DeployMetaData("MyLocalDBPackage.pkg", "", New DatabaseTargetName() {loDatabase})




Reply
Randy Jean
Randy Jean
StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
Trent L. Taylor (10/13/2008)
Yeah, the DDT actually uses the DatabaseMigrator class itself.




That's what I figured...



But if you get stuck, let me know and I will try and give you some code to move ahead.




I'm stuck. I'm creating an array. I step in and see that NameOnServer is definitely set to BayerAcquireLocalTest (which is what I want it to create) but it just keeps ignoring this and goes against BayerAcquireLocal every time no matter what.



I created a small test project with a brand new DDT package and database, tried the same type of code and it works fine, so unfortunately can't send you a simple re-producible scenario. Also, like I said, the deployment wizard works fine with my package, too, and if I change the target name it does what I expect.



I can't figure out what in my code would be causing it to completely ignore the fact that I am changing the NameOnServer property.



Code based on deployment progress dialog sample - is there something wrong with the order I'm doing things?:







Private Sub StartDeployment()



Dim loDatabase As New DatabaseTargetName("BayerAcquireLocalDB")



loDatabase.NameOnServer = CStr(IIf(BayerAcquire.AppMain._TestEnv, "BayerAcquireLocalTest", "BayerAcquireLocal"))



'-- Establish Locals

Dim loSQL As New MicroFour.StrataFrame.DBEngine.SQL.SQLServerSchema()



' Check for database updates - can only update local DB

If My.Computer.FileSystem.FileExists(_PackagePath & "BayerAcquireLocalDB.pkg") Then



Dim connString As String = MicroFour.StrataFrame.Data.DataBasics.DataSources.Item("LocalTables").ConnectionString().ToString()

Dim s As String() = Split(connString, ";")

_SQLServer = s(0).Replace("Data Source=", "")



' _SQLServer = "localhost\SQLEXPRESS"



Else

MsgBox("Database update package not found.", MsgBoxStyle.Exclamation, "Database Update")

DialogResult = Windows.Forms.DialogResult.Cancel

Exit Sub

End If





'-- See if the SQL connection can be established. Change the privates above to make this

' work in your environment if localhost is not a valid connection. Another option is to

' create a form that asks for this information or pull it from the registry.

If Not loSQL.IsValidConnection(_SQLServer, _SQLUserName, _SQLPassword) Then

MsgBox("The specified SQL connection information could not be authenticated. Deployment halted.", MsgBoxStyle.Exclamation, "Invalid Connection")

DialogResult = Windows.Forms.DialogResult.Cancel

Exit Sub

End If



'-- The package path is installed with StrataFrame and resides in the Common Files folder

' _PackagePath = AddBS(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles)) & "MicroFour\StrataFrame\"



'-- Create the DatabaseMigrator instance

If _SQLUserName.Length = 0 Then

_DatabaseSetup = New DatabaseMigrator(_SQLServer, True, Me)

Else

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

End If



'-- Begin the deployment of the meta-data (does not include the data in this phase)

_DatabaseSetup.EnableLogging = True

_DatabaseSetup.DeployMetaData(_PackagePath & "BayerAcquireLocalDB.pkg", _

"", New DatabaseTargetName() {loDatabase})



End Sub







See attached image showing that when I step on the DeployMetaData you see my NameOnServer is definitely different but it doesn't have any effect. Hmmmm... Maybe I need to try stepping into Strataframe code now that I know how to do this! But let me know if you see anything funny about my code. The only special stuff is that I validate the connection to the server and extract the actual server instance name from the existing connection, but I can't see how that could mess up what's in the databasemigrator.

Attachments
ddt metadata deploy debug.jpg (291 views, 32.00 KB)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Randy Jean - 17 Years Ago
Dustin Taylor - 17 Years Ago
Randy Jean - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Randy Jean - 17 Years Ago
                         Yup, that is exactly what we do! Go for it!
Trent L. Taylor - 17 Years Ago
                             Cool, that worked as far as fixing it from trying to drop my existing...
Randy Jean - 17 Years Ago
                                 Yeah, the DDT actually uses the DatabaseMigrator class itself. When...
Trent L. Taylor - 17 Years Ago
                                     [quote][b]Trent L. Taylor (10/13/2008)[/b][hr]Yeah, the DDT actually...
Randy Jean - 17 Years Ago
                                     Got it! Man that being able to debug into SF source is the bomb!...
Randy Jean - 17 Years Ago
                                         Yup...good find...I had already started to respond to your post and...
Trent L. Taylor - 17 Years Ago
                                             Trent, One question about this situation,is the ContainsKey...
Edhy Rijo - 17 Years Ago
                                                 Yes...I think that there is an overload that allows the...
Trent L. Taylor - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search