Mobile Management For SQL Server(s!) - Siccolo - SQL Management Tool
Main     
(I) - How To Develop SQL Mobile Management Tool (and How I created one) :
Engineered to help you extend your support from mobile devices for Microsoft SQL Servers.

Part I - Planning Part II - Simple Prototype for mobile management tool
Part III - Securing Mobile To Server Communication Part IV - Developing SQL Server related management interfaces
Part V - Developing SQL Server Jobs related management interfaces Part VI - Developing SQL Server Jobs control management interfaces (Enable/Disable/Start)
Part VII - Developing SQL Server Agent related control management interfaces Part VIII - Developing SQL Server related control management interfaces

How to retrieve database list How to retrieve table list How to execute SQL command
How to retrieve SQL Server job list How to retrieve SQL Server job info with execution history How to enable/disable SQL Server job
How to run SQL Server job How to retrieve SQL Server Agent status How to start/stop SQL Server Agent
How To Impersonate How to Get Dependent Services How to Restart SQL Server Service
How to Stop Service How to Start Service
A little foreword
 
How it all started….It all started with my new phone – Cingular 8125, I got all excited – wow, I can read emails, browse the internet, and manage servers from mobile device… Yeah, right. Internet, well, yes; emails – corporate emails ok, hotmail not so ok. And to manage servers (particularly SQL Servers) - wew...not an easy task.

The part that worried me was – how would I support corporate environment if am I away (working for a very small company has many benefits, and having a big IT department is not one of them. So, every time I look in the mirror, I see our complete IT department). And “The Search For Perfect Mobile Management Tool" started! …And shortly ended. Apart from connecting via VPN and using Terminal Services, I found only two mobile management tools “out there” to enable me supporting servers (and especially SQL Servers) when I am away – Id*ra (795$ per instance for SQL Mobile – ouch! ouch!) and Idok*orro (245$ per server – not bad). They all require connecting via VPN to corporate LAN. Didn’t like that idea…

Thus, I thought, shall I create one of my own? Why not! And after a shot of B12 given me at Clarity MediSpa to boost my immune system, I began!
 
 
Part I - Planning
 
And with this “The Mobile Management Tool Development” began.

    I had the following application in mind (in the order of priorities):
  1. Quick to develop.
  2. Without using VPN (means host “something” on the public IP – scary).
  3. Allows to manage SQL Server(s) from mobile device.
  4. Allows to run SQL queries from mobile device.
  5. Fast (well, kind of fast) and responsive (as much as device allows).
  6. Small.
  7. Stable. If it crumbles – should save some information to event log on the server/text file on the client.
  8. Allows me to connect to different servers.
Luckily, Microsoft came to the rescue with its Visual Studio and ability to develop for PocketPC devices.
My plan was – build classic “client-server” application using web services hosted on IIS/.NET and make it secure with SSL and Windows authentication.
 
 
Part II - Simple Prototype for mobile management tool
 
First, I had to develop some kind of “prototype” to see how “feasible” the development will be (according to #1 of my plan). Being more familiar with Visual Basic, I developed quick web service that outputs server time:

	 Public Function ServerTime(ByRef ServerTimeValue As String, _
                                                 ByRef ErrorInfo As String) As Boolean

            Try

                Dim ToDebugSetting As String = System.Configuration.ConfigurationSettings.AppSettings.Get("DebugMode")
                Dim ToDebug As Boolean = (ToDebugSetting <> "")

                ErrorInfo = ""
                ServerTimeValue = System.DateTime.Now.ToString("MM/dd/yyyy") & " " & System.DateTime.Now.ToString("HH:mm:ss")

                If ToDebug Then
                    oCon.UpdateIncomingStatus("Server Time [" & ServerTimeValue & "]", EventLogEntryType.Information)
                End If

                Return True

            Catch ex As Exception
                ServerTime = ""
                ErrorInfo = ex.Message
                Return False
            End Try

        End Function

	
And on the client side (i.e. mobile device):

	Friend Function RunServerTest(ByRef ServerTime As String, ByRef ErrorInfo As String) As Boolean
        Try
            ErrorInfo = ""

            If objSQLWebServiceManager.ServerTime(ServerTime, _
                                                    ErrorInfo) Then

                If ErrorInfo <> "" Or ServerTime = "" Then Return False

                Return True

            Else
                Return False
            End If

        Catch ex As Exception
            ErrorInfo = ex.Message

            'MessageBox.Show(ex.ToString, "RunServerTest")
            If m_LogErrorToFile Then LogError("RunServerTest():" & ex.ToString)

            Return False
        End Try
	End Function
	
* where objSQLWebServiceManager is an instance of web service: objSQLWebServiceManager = New siccolo.Siccolo()

Built, put it on the device, boom, worked.
So, as we can see Web Services is quickly finding its way into major system integration development efforts. In back office and legacy systems alike, Web Servicess has become a main focus in providing mechanisms to make data move more freely between and across long-closed boundaries. An entire industry has joined forces and pushes forward in overcoming both technical hurdles such as security and market specific hurdles such as the need of standardized message formats. While these efforts continue, an entirely different market is rapidly maturing: the mobile devices, software and services market. Very interesting solution options arise in the cross section, where Web Services meets mobility. The Microsoft® Windows® .NET Compact Framework opens up the world of Web Services to Pocket PCs, and the wireless nature of Pocket PCs opens up the world of mobility to Web Services. This means that new fuel is added to the expansion of the XML-based Web Services provider market. In this article, we will see a Siccolo Pocket PC project that combines Web Services into powerful SQL Server Mobile Management Tool!
 
 
Part III - Securing Mobile To Server Communication
 
Then, came the question – how can I secure the “communication”?
    There're two:
  1. SSL - provides message integrity and security - set web to require secure channel and 128 bit encryption
  2. and Web server (IIS) provides Basic and Integrated authentication (plus Digest and Certificate)
(...you can also encrypt in-and-out messages between server and client using .NET System.Security.Cryptography)

And again Microsoft to the rescue – using “Integrated Windows Authentication” (if you have .NET CF 2.0) or “Basic Authentication” (if you have .NET CF 1.0). It was very simple to integrate authentication into the mobile client :
	  Dim objNetworkCredential As System.Net.NetworkCredential = _ 
					New System.Net.NetworkCredential(NetworkUserName, _
                                        				NetworkUserPwd, _
                                                                        NetworkDomain)

            objSQLWebServiceManager = New siccolo.Siccolo()
            objSQLWebServiceManager.Credentials = objNetworkCredential
            objSQLWebServiceManager.PreAuthenticate = True
	
after credentials are set, make the call away. Easy.
  Continue to (II)



Free Mobile Management For SQL Server(s!) - Siccolo - SQL Management ToolQuestions? Suggestions? Concerns? - email me to siccolo_mobile_management@yahoo.com    Greg Dubinovsky © 2006-2007
or share your thoughts at Siccolo Blog

Web being sponsor - Mid-Atlantic Processing. Well being sponsor - Clarity MediSpa. Hairless sponsor - Clarity MediSpa Laser Hair Removal.