Red Gate forums :: View topic - Do I have the right tool.
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Comparison SDK Previous Versions
SQL Comparison SDK Previous Versions forum

Do I have the right tool.

Search in SQL Comparison SDK Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
FredMorin



Joined: 26 Nov 2008
Posts: 7

PostPosted: Sun Feb 21, 2010 1:15 am    Post subject: Do I have the right tool. Reply with quote

Here is what my situation is...

I have an master application that uses sql server as it's back-end.

I was successfully able today to generate a upgrade script with the samples of Comparaison SDK no sweat.

I then want to put that file on a ftp server somewhere. Again no sweat.

Now on the client side, there will be an app I wrote which will use the database as well, but locally this time... Therefore, whenever they logon I will check to see if there is a update file on the ftp, no problems....if there is I want to download it and then silently execute it...

So my question is this... is there an easy was to get the EXE generated by the SDK to silently run....

thanks
Back to top
View user's profile Send private message
peter.peart
Site Admin


Joined: 02 Sep 2008
Posts: 362
Location: Top floor, RG towers with the cool kids

PostPosted: Mon Feb 22, 2010 4:04 pm    Post subject: Reply with quote

Hi there,

Many thanks for your post.

Depending on how you are getting the .EXE to run, you can do this through the command line by specifying the following:

Code:
Applicationname.exe /quiet /server:XXX /database:XXX /username:XXX /password:XXX


Does this answer your question?

Pete
_________________
Peter Peart
Red Gate Software Ltd
+44 (0)870 160 0037 ext. 8569
1 866 RED GATE ext. 8569
Back to top
View user's profile Send private message Send e-mail
FredMorin



Joined: 26 Nov 2008
Posts: 7

PostPosted: Mon Feb 22, 2010 8:53 pm    Post subject: Reply with quote

Is there another switch needed to specify if i want to create a database or upgrade an existing one...
Back to top
View user's profile Send private message
peter.peart
Site Admin


Joined: 02 Sep 2008
Posts: 362
Location: Top floor, RG towers with the cool kids

PostPosted: Mon Feb 22, 2010 9:00 pm    Post subject: Reply with quote

Hi there,

The /quiet switch just forces the .EXE to be run from the command line without a GUI popping up at all.

I would have thought that if you were creating a new DB or creating an upgrade, that would have all been built into the .EXE, therefore there isn't a need for any additional switches.

Pete
_________________
Peter Peart
Red Gate Software Ltd
+44 (0)870 160 0037 ext. 8569
1 866 RED GATE ext. 8569
Back to top
View user's profile Send private message Send e-mail
FredMorin



Joined: 26 Nov 2008
Posts: 7

PostPosted: Mon Feb 22, 2010 9:55 pm    Post subject: Reply with quote

Thanks for the quick reply...

I am very green as far as the SQL packagerCode Snippets goes.

I know after running the sample I was able to create the EXE but when I would manually run it, I was given the option to Create a New DB or Upgrade.

Is there something I missed in those samples
Back to top
View user's profile Send private message
peter.peart
Site Admin


Joined: 02 Sep 2008
Posts: 362
Location: Top floor, RG towers with the cool kids

PostPosted: Tue Feb 23, 2010 11:59 am    Post subject: Reply with quote

Hi there,

If you wanted to create a database from scratch, then you would use the following:

Code:
Applicationname.exe /quiet /server:XXX /database:<DBNameToBeCreated> /username:XXX /password:XXX


If you were running an executable that upgraded a DB, the syntax would be:

Code:
Applicationname.exe /quiet /server:XXX /rundatabase:<DBNameToBeUpgraded> /username:XXX /password:XXX


A full list of command line switches available can be found if you run the following from the command line:

Code:
 sqlpackager /? /V /html > %FileOutputPath.htm%


Hope that helps!

Pete
_________________
Peter Peart
Red Gate Software Ltd
+44 (0)870 160 0037 ext. 8569
1 866 RED GATE ext. 8569
Back to top
View user's profile Send private message Send e-mail
FredMorin



Joined: 26 Nov 2008
Posts: 7

PostPosted: Tue Feb 23, 2010 3:43 pm    Post subject: Reply with quote

Thanks...

I just realized that I have more to do that I thought.


I figured out using the SQLDATACompareCodeSnippets and the SQL ProviderExample will synchronize the data on the second database quite easily.

However, what I want to is create a package with the block so I can send that package on a FTP server and then my clients will retrieve that at their convenience and update.

I figured it out...

Since I use a second database locally which is a copy of the clients database.... i have to create the package and update the second database.. so i need to execute the block AND package it

Dim executor As New BlockExecutor()
executor.ExecuteBlock(provider.Block, serverName, LiveDatabaseName)


This updates the local destination database

AND

Using engine As PackagerEngine = New PackagerEngine(TemplateFolder, TargetPackageFolder, PackageName, m_SchemaBlock, m_DataBlock, OutputType.Executable)

'
' Add properties for the package
'
AddPackagerProperties(engine, serverName, databaseName, schemaOptions, dataOptions)

Console.WriteLine("Packaging the blocks into the target executable")
RaiseEvent SomethingHappened("Packaging the blocks into the target executable", Nothing)

engine.Package()

Console.WriteLine("Packaged database '{0}' on server '{1}'", databaseName, serverName)
Dim s As String = String.Format("Packaged database '{0}' on server '{1}'", databaseName, serverName)

RaiseEvent SomethingHappened(s, Nothing)
s = String.Format("Generated program '{0}'", TargetFullFileName)
Console.WriteLine(s)
RaiseEvent SomethingHappened(s, Nothing)
End Using

packages the whole thing quite nicely

I also created a table to specify which tables are to be updated.

I therefore filter my tablemappings in my SetDataExecutionBlock

For Each tm As TableMapping In TableMappings
If DataRepository.SyncroTablesProvider.GetByCode(tm.Obj1.Name).Syncroniser = True Then
tm.Include = True
Else
tm.Include = False
End If
Next

And do the same in the SetSchemaExecutionBlock
Back to top
View user's profile Send private message
peter.peart
Site Admin


Joined: 02 Sep 2008
Posts: 362
Location: Top floor, RG towers with the cool kids

PostPosted: Thu Feb 25, 2010 6:13 pm    Post subject: Reply with quote

Hi there,

I am glad that you managed to get this working for you. If you need any further help, just let us know.

Pete
_________________
Peter Peart
Red Gate Software Ltd
+44 (0)870 160 0037 ext. 8569
1 866 RED GATE ext. 8569
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group