Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I test locally against SQL Azure?

Looks like Azure Storage Emulator omits SQL Azure. Does it hold true? Then how do I test my application that uses SQL Azure without deploying it onto live cloud?

like image 276
sharptooth Avatar asked May 24 '11 06:05

sharptooth


People also ask

How do I access Azure SQL Database from on premise?

On the on-premises client computer, open SQL Server Management Studio. In the Connect to Server dialog box, enter the fully qualified host name for your managed instance in the Server name box. Select SQL Server Authentication, provide your username and password, and then select Connect.

How do I access Azure database from local machine?

If it doesn't open, you can open it manually by selecting Object Explorer > Connect > Database Engine. For Server type, select Database Engine (usually the default option). For Server name, enter the name of your Azure SQL Database or Azure Managed Instance name. Use SQL Server Authentication for Azure SQL to connect.

Can you ping Azure SQL Server?

The ping command is supposed to give you a timeout because SQL Azure servers never respond to ping requests, but above the timeout replies it tells you the actual IP of your SQL Azure server. Use that IP to telnet your SQL Azure server.


2 Answers

For local testing, you can use a local SQL Server (full, express or even CE) within your app - just use local connectionstring's in place of the SQL Azure ones in your .cscfg or .config files - then the local compute instance will connect just like any other local process would.

For the most part local SQL and SQL Azure are compatible and interchangeable. Microsoft claim that SQL Azure shares much of its codebase with SQL Server 2008 R2. As a result you can use SQL Server 2008 R2 or SQL Server 2008 Express locally in order to test your application. Indeed, for "simple" applications you should also be able to use the new file-based SQL Server CE.


For "advanced" applications, then there are some limitations with SQL Azure - see limitations on http://msdn.microsoft.com/en-us/library/ee336245.aspx - but for many ASP.Net applications, you should be able to just migrate from SQL express to SQL Azure.

For more details on SQL vs SQL Azure, see http://social.technet.microsoft.com/wiki/contents/articles/comparing-sql-server-with-sql-azure.aspx

For migrating data from local SQL to SQL Azure, see the SQL Migration Wizard on Codeplex - http://sqlazuremw.codeplex.com/

like image 101
Stuart Avatar answered Oct 27 '22 15:10

Stuart


i suggest you use SQL server 2008 express for onpremise development. you can migrate that to cloud once you are ready. But you need to be aware of contemporary limitations and also some architectural considerations while using SQL server.

And the best part is that you just need to change the connection string to connect to SQL Azure after the migration.

like image 42
paras_doshi Avatar answered Oct 27 '22 14:10

paras_doshi