Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > Windows Azure > Windows Azure and SQL Azure / SQL Database > ตอนที่ 6 : SQL Azure รู้จักกับ Connection String สิทธิ์การใช้งาน SQL Database



Clound SSD Virtual Server

ตอนที่ 6 : SQL Azure รู้จักกับ Connection String สิทธิ์การใช้งาน SQL Database

ตอนที่ 5 : SQL Azure รู้จักกับ Connection String และสิทธิ์ในการใช้งาน หลังจากที่เราได้ทำการสร้าง SQL Azure หรือ SQL Database บน Windows Azure เรียบร้อยแล้ว เราจะมาเรียนรู้กฏและเงื่อนไขการใช้งาน SQL Database ว่าจะมีรูปแบบการเรียกใช้งานจาก Application อื่น ๆ ได้อย่างไร และจากบทความก่อน ๆ ตามที่ได้เกรินไว้ SQL Database สามารถรองรับการทำงานร่วมกับ Application ได้อย่างหลากหลาย ไม่ว่าจะเป็นในตระกูลของ .Net Application / PHP / Java และอื่น ๆ

โดยในการใช้งาน SQL Database นั้น Application ที่เรียกใช้งานไไม่จำเป็นจะต้องทำงานอยู่ภายใต้ Service อื่น ๆ ของ Windows Azure เท่านั้น แต่เราสามารถที่จะกำหนดให้สามารถเรียกจากแหล่ง Data Center อื่น ๆ ได้เช่นเดียวกัน แเพียงแต่การที่จะเรียกใช้จาก Data Center อื่น ๆ จะต้องมีการกำหนด Allow IP สำหรับ Application ที่จะทำการ Access เข้ามาใช้ SQL Database ด้วย

SQL Azure Connection String

Service ของ SQL Database ที่เราได้สร้างขึ้น ในบทความก่อน ๆ หน้านี้

SQL Azure Connection String

เข้าหน้าหลักของหน้าจอสำหรับการจัดการกับ SQL Database นั้น ๆ ซึ่งจะอยู่ก่อนหน้า Dashboard ให้เราคลิกที่

View SQL Database connection strings for ADO.Net, ODBC, PHP, amd JDBC

SQL Azure Connection String

Connection String ที่เราจะสามารถนำไปใช้กับ Application ในรูปแบบต่าง ๆ ที่จะพัฒนาขึ้น








ADO.NET:
Server=tcp:bc6hela9fr.database.windows.net,1433;Database=thaicreate-db;User ID=thaicreate-user@bc6hela9fr;Password={your_password_here};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;


ODBC:
Driver={SQL Server Native Client 10.0};Server=tcp:bc6hela9fr.database.windows.net,1433;Database=thaicreate-db;Uid=thaicreate-user@bc6hela9fr;Pwd={your_password_here};Encrypt=yes;Connection Timeout=30;


PHP:
Server: bc6hela9fr.database.windows.net,1433 
SQL Database: thaicreate-db
User Name: thaicreate-user
Password={your_password_here}


PHP Data Objects(PDO) Sample Code:
try {
	$conn = new PDO ( "sqlsrv:server = tcp:bc6hela9fr.database.windows.net,1433; Database = thaicreate-db", "thaicreate-user", "{your_password_here}");
	$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
}
	catch ( PDOException $e ) {
	print( "Error connecting to SQL Server." );
	die(print_r($e));
}


PHP SQL Server Extension Sample Code:
$connectionInfo = array("UID" => "thaicreate-user@bc6hela9fr", "pwd" => "{your_password_here}", "Database" => "thaicreate-db", "LoginTimeout" => 30, "Encrypt" => 1);
$serverName = "tcp:bc6hela9fr.database.windows.net,1433";
$conn = sqlsrv_connect($serverName, $connectionInfo);


JDBC:
jdbc:sqlserver://bc6hela9fr.database.windows.net:1433;database=thaicreate-db;user=thaicreate-user@bc6hela9fr;password={your_password_here};encrypt=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;


เพิ่มเติม
การใช้งานการเชื่อมต่อาจจะสามารถใช้ในรูปแบบอื่น ๆ ได้ แต่เพื่อประสิทธิภาพสูงสุดในการเชื่อมต่อ แนะนำให้ใช้รูปแบบตามที่ไดแจ้งใว้

SQL Azure Connection String

ในกรณีที่ Application เรียกใช้ภายนอกเหนือจาก Windows Azure จะต้องไปที่ Manage allowed IP addresses

SQL Azure Connection String

ทำการเพิ่ม IP ที่จะเชื่อมต่อ

SQL Azure Connection String

ในตัวอย่างจะเป็น IP ที่ต่อจาก ADSL

เพิ่มเติม
ในกรณีที่เราสร้าง Web ไว้บน Web Server ที่ไม่ใช่ Windows Azure แต่จะเรียกใช้ SQL Database เราจะต้อง Allow IP ที่เป็นของ Web Server (ไม่ใช่ Client ที่เรียกใช้ Web)

SQL Azure Connection String

การ Allow IP จะต้องทำการ SAVE ทุกครั้ง

SQL Azure Connection String

เมนู HISTORY สามารถที่จะแก้ไข Username และ Password ของ SQL Database ได้

SQL Azure Connection String

เมนู CONFIGURE จะเห็นในส่วนของ WINDOWS AZURE SERVIES ตัวนี้หมายถึงจะอนุญาติให้ Service ที่อยู่บน Windows Azure สามารถที่จะเรียก SQL Database ตัวนี้ใช้ได้หรือไม่ (ค่าปกติควรจะเป็น Yes)

สำหรับการใช้งาน SQL Database ร่วมกับ Application อื่น ๆ เช่น .NET Application หรือ PHP สามารถที่จะอ่านได้จากหัวข้อถัดไป








อ่านเพิ่มเติม


   
Share


ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2013-05-02 09:40:30 / 2017-03-24 10:54:30
  Download : No files
 Sponsored Links / Related

 
ตอนที่ 1 : รู้จักกับ Service ของ SQL Azure / SQL Database บน Windows Azure
Rating :

 
ตอนที่ 2 : การสร้าง SQL Azure และการใช้งาน SQL Database บน Windows Azure
Rating :

 
ตอนที่ 3 : เชื่อมต่อ SQL Database ผ่าน SQL Server Management Studio (SSMS)
Rating :

 
ตอนที่ 4 : เชื่อมต่อ SQL Azure ผ่าน Microsoft SQL Server Data Tools (SSDT)
Rating :

 
ตอนที่ 5 : การ Backup และ Import Restore บน SQL Azure / SQL Database
Rating :

 
ตอนที่ 7 : การใช้งาน SQL Azure ร่วมกับ PHP (SQL Server) (Odbc/sqlsrv/PDO)
Rating :

 
ตอนที่ 8 : เขียน PHP เช่นการ Insert / Update / Delete ข้อมูลบน SQL Database
Rating :

 
ตอนที่ 9 : การเขียน .Net Application ร่วมกับ SQL Database บน Windows Azure
Rating :

 
ตอนที่ 10 : เขียน .NET แบบ Client Server ติดต่อ SQL Azure / SQL Database
Rating :

 
ตอนที่ 11 : การเขียน Java Application ร่วมกับ SQL Database บน Windows Azure
Rating :

 
ตอนที่ 12 : Example : Java กับ JDBC ติดต่อ SQL Database บน Windows Azure
Rating :

 
ตอนที่ 13 : Example : Java GUI ติดต่อ SQL Database บน Windows Azure
Rating :

 
ตอนที่ 14 : Example : JSP (Java) ติดต่อ SQL Database บน Windows Azure
Rating :

 
ตอนที่ 15 : แหล่งความรู้ SQL Azure / Database ประยุกต์กับการเขียนโปรแกรมต่าง ๆ
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 01
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่