Using an existing SQL instance with Azure SDK

Source: Internet
Author: User
Tags windows azure sdk azure sdk

Original article: http://azurecoding.net/blogs/brownie/archive/2008/11/21/using-an-existing-sql-instance-with-azure-sdk.aspx

David Justice provided this tip on his blog. but if you already have access to a SQL Server Installation, You're not limited to using SQL Express. you don't even have to use a local SQL installation. just open developmentstorage.exe. config in your azure SDK bin directory and change the two lines that refer to sqlexpress to point to the instance you want.

Also there is a command line parameter for devtablegen that you have to pass in order to get it to generate the tables on an instance other than the default sqlexpress. passing/Server: <myserver [\ myinstancename]> to devtablegen will cause it to generate your table storage on a SQL instance with the same name. in fact, if you're re going to be using the samples with a predetermined SQL instance, you might as well change it so that rundevstore. CMD will generate the tables for you. I did the digging so you don't have. first we want to change the Microsoft. samples. servicehosting. targets file. this file is ultimately responsible for calling devtablegen.

  1. Insert a line after the opening for the Property Group at the top of the file (line 3)
  2. Paste these lines into the file

    <! -- Allow user to pass the server parameter to devtablegen -->
    <Devstoreparam condition = "'$ (InstanceName )'! = ''">/Server: $ (InstanceName) </devstoreparam>
    <Devstoreparam condition = "'$ (InstanceName)' ='' "> </devstoreparam>

  3. Replace the updatesamplestabledb (do a search but shocould be near line 130) with the following

    <Target name = "updatesamplestabledb" dependsontargets = "buildsubprojects">
    <Message text = "$ (devtablegencommand) $ (devstoreparam)/Database: $ (samplesdbname) $ (devtablegenforcecreateflag) @ (devtablegenassemblies)"/>
    <Exec condition = "'$ (samplesdbname )'! = ''"
    Command = "$ (devtablegencommand) $ (devstoreparam)/Database: $ (samplesdbname) $ (devtablegenforcecreateflag) @ (devtablegenassemblies )"
    Workingdirectory = "$ (msbuildprojectdirectory)"/>
    </Target>

What we did here was allow a parameter called InstanceName to be passed into msbuild that will be passed to devtablegen. all we have to do now is update rundevstore. CMD to pass in the parameter. replace line 21 in rundevstore. CMD with the following:

% Msbuild \ buildall. proj/T: rundevstoreonsamplestabledb/P: samplesdbname = servicehostingsdksamples; forcetablecreate = true; InstanceName =.

Replace. at the end with your instance name (unless it's the default instance on local, in that case. is the shortcut for that ). open your windows azure SDK prompt, navigate to your samples directory, execute rundevstore and voila, you 've broken the chains to SQL Express.

What's that you say, too lazy to do all that file opening, cutting and pasting? Have no fear! Here are the sample files for your convenience.

Microsoft.samples.servicehosting.tar gets

Rundevstore. cmd

Published Friday, November 21,200 8 am by Mike Brown

Filed under: Windows Azure, samples, tips and tricks, devstorage

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.