Download presentation
Presentation is loading. Please wait.
Published byAnna McLaughlin Modified over 9 years ago
2
SQL Azure Database Windows Azure SQL Database is a feature-rich, fully managed relational database service that offers a highly productive experience, incorporates proven SQL Server technology, and delivers business-class capabilities. SQL Database allows customers to scale business apps for burst and global reach by removing the high costs of building an infrastructure which would accommodate occasional peak loads. Customers can also remove the security risks and hassles associated with hosting public-facing apps & websites from within a datacenter by quickly & cost-effectively building websites and mobile & social apps directly on SQL Database.
3
SQL Azure Database Access To access a SQL Azure database from the Microsoft.NET Framework code, you can use standard ADO.NET: the SqlCommand class to define a command, a SqlDataReader to pull data out, or SqlDataAdapter, because internally SQL Azure uses a SqlDataReader in a traditional manner. You only have to adapt the SqlConnection class’s connection string. After you change it to the cloud version of the server, you just log on.
4
SQL Azure Database Access Example using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Data;
5
SQL Azure Database Access Example namespace TAServices{ public partial class _Default : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e){ try{ using (SqlConnection conn = new SqlConnection()){ conn.ConnectionString = "someconnectionstring";
6
SQL Azure Database Access Example using (SqlCommand cmd = new SqlCommand()){ cmd.Connection = conn; cmd.CommandText = "SELECT CustomerID from customers"; conn.Open(); using (SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnect ion)){ while (dr.Read()){ // Do something }
7
SQL Azure Database Access Example dr.Close(); } catch (SqlException ex){ // Something goes wrong }
8
SQL Azure Database Access Example dr.Close(); } catch (SqlException ex){ // Something goes wrong }
9
SQL Azure Database Access Connection String Examples Classic Connection connection string for a trusted SQL connection Server=myServer;Database=myDb; Trusted_Connection=Yes; If you are using a standard SQL connection instead of a trusted one, you have to modify the connection as shown in the following code: Server=myServer;Database=myDb; Trusted_Connection=Yes; User ID=user;Password=password; Trusted_Connection=False;
10
SQL Azure Database Access Connection String Examples Connection String for Entity Framework metadata=res://*/ Model.csdl|res://*/ DataModel.ssdl|res://*/DataModel.msl; provider=System.Data.SqlClient; provider connection string="Data Source=VirtualServerName.database.windows.net; Initial Catalog=MyDB;Integrated Security=False; User ID=user@VirtualServerName; Password=password; MultipleActiveResultSets=False; Encrypt=True;TrustServerCertificate=False"" providerName="System.Data.EntityClient"
11
SQL Azure Database Access Code to Access SQL Azure Database using java hibernate.connection.driver_class=com.microsoft.sqlserver.jdbc.SQLServerDriver hibernate.connection.url=jdbc:sqlserver://Virtu alServerName.database.windows.net:1433; databaseName=mydb hibernate.connection.username=user@VirtualServe rName hibernate.connection.password=password
12
SQL Azure Database Access Code to Access SQL Azure Database using PHP $server = "tcp:VirtualServerName.database.windows.net,1433 "; $user = "User@VirtualServerName"; $pass = "password"; $database = "MyDB"; $connectionoptions = array("Database" => $database, "UID" => $user, "PWD" => $pass, "MultipleActiveResultSets" => false); $conn = sqlsrv_connect($server, $connectionoptions);
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.