Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 16 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
16
Dung lượng
1,01 MB
Nội dung
Instructor Inputs Session 5 ¤NIIT Instructor Inputs 5.3 This session includes the following topics: Web services Securing HTTP endpoints Best practices Tips and Tricks FAQs Slide 1 Installing Windows XP Professional Using Attended Installation Slide 1 of 17 Ver. 1.0 Querying, Managing, and Administering Databases using SQL Server 2005 Collaborative Session 4 Collaborate Session 5 Objectives In this session, you will learn about: Web services Securing HTTP endpoints Best practices that can be considered while using triggers and transactions in SQL Server 2005 Tips and tricks that will help you effectively use triggers and transaction statements in SQL Server 2005 FAQs related to triggers and managed code in SQL Server 2005 Session Overview 5.4 Instructor Inputs ¤NIIT Slide 2 Installing Windows XP Professional Using Attended Installation Slide 2 of 17 Ver. 1.0 Querying, Managing, and Administering Databases using SQL Server 2005 Collaborative Session 4 Collaborate Session 5 Knowledge Byte Web service: Exposes a number of methods to provide functionality that can be used by one or more applications, regardless of the programming languages, operating systems, and hardware platforms used to develop them. Uses Internet standards, such as HTTP and XML, to communicate with client applications. Is similar to a component that provides a specific functionality. Can be created by using any programming language in the .NET suite, such as Visual Basic .NET, Visual C# .NET, and Visual C++ .NET. Displays data on the Internet to trusted suppliers, customers, or business partners. However, you need to ensure that only appropriate people gain access to a critical data. Therefore, it is important to secure the HTTP endpoint. Slide 3 Installing Windows XP Professional Using Attended Installation Slide 3 of 17 Ver. 1.0 Querying, Managing, and Administering Databases using SQL Server 2005 Collaborative Session 4 Collaborate Session 5 Knowledge Byte (Contd.) To secure endpoints, perform the following steps: Create appropriate user accounts within the database. Grant permissions for any stored procedure or user-defined functions that the user or roles need to access by using the Web service. Grant permissions to allow users or roles to connect to the HTTP endpoints. ¤NIIT Instructor Inputs 5.5 Slide 4 Installing Windows XP Professional Using Attended Installation Slide 4 of 17 Ver. 1.0 Querying, Managing, and Administering Databases using SQL Server 2005 Collaborative Session 4 Collaborate Session 5 Best Practices Use sp_recompile system procedure on a trigger or a stored procedure to recompile so that the updated procedure and trigger can be used. Disable all the triggers on a database if you do not want to use them for sometime. The following command allows you to disable all triggers: EXEC sp_MSforeachtable @command1="ALTER TABLE? DISABLE TRIGGER ALL" Slide 5 Installing Windows XP Professional Using Attended Installation Slide 5 of 17 Ver. 1.0 Querying, Managing, and Administering Databases using SQL Server 2005 Collaborative Session 4 Collaborate Session 5 Best Practices (Contd.) If you have to write complex procedural code use the CLR managed code. It is faster than T-SQL statements. If you have data access task that contain little or no procedural code, use T-SQL programming. This is because you can write and execute it directly from the Code Editor Result window. 5.6 Instructor Inputs ¤NIIT Slide 6 Installing Windows XP Professional Using Attended Installation Slide 6 of 17 Ver. 1.0 Querying, Managing, and Administering Databases using SQL Server 2005 Collaborative Session 4 Collaborate Session 5 Tips and Tricks You can create a trigger to extract the information of the record that is being changed by using the inserted and deleted tables. You can use the managed code to create a trigger, stored procedure, and user defined function. You can resolve deadlocks in transactions by using a TRY/CATCH block. Use exception handling with the transactions. If any exception occurs in a transaction execution, rollback the transaction. Slide 7 Installing Windows XP Professional Using Attended Installation Slide 7 of 17 Ver. 1.0 Querying, Managing, and Administering Databases using SQL Server 2005 Collaborative Session 4 Collaborate Session 5 How can you perform an action when the schema of a table is changed? You can use DDL triggers to perform an action when the schema of a table is changed. DDL triggers can only be created to fire AFTER the triggering event has occurred, as opposed to DML triggers that can fire AFTER the event or INSTEAD OF the event. FAQs ¤NIIT Instructor Inputs 5.7 Slide 8 Installing Windows XP Professional Using Attended Installation Slide 8 of 17 Ver. 1.0 Querying, Managing, and Administering Databases using SQL Server 2005 Collaborative Session 4 Collaborate Session 5 Which category of triggers is available with SQL Server 2000? SQL Server 2000 supports DML triggers. SQL Server 2005 has introduced another category of trigger named DDL trigger. FAQs (Contd.) Slide 9 Installing Windows XP Professional Using Attended Installation Slide 9 of 17 Ver. 1.0 Querying, Managing, and Administering Databases using SQL Server 2005 Collaborative Session 4 Collaborate Session 5 How can you restrict an update on the column of a table? To restrict a column update, use the following syntax: CREATE TRIGGER <trigger name> ON <db name>.<table name> FOR UPDATE AS IF UPDATE(<col name>) BEGIN RAISERROR ('Cannot be updated',10,1) ROLLBACK TRANSACTION END GO FAQs (Contd.) 5.8 Instructor Inputs ¤NIIT Slide 10 Installing Windows XP Professional Using Attended Installation Slide 10 of 17 Ver. 1.0 Querying, Managing, and Administering Databases using SQL Server 2005 Collaborative Session 4 Collaborate Session 5 Which new feature has been added to SQL Server 2005, which is an enhancement to T-SQL? The .NET Common Language Runtime is an enhancement to T-SQL. It gives much more flexibility to programming in SQL Server 2005 as compared to T-SQL. FAQs (Contd.) Slide 11 Installing Windows XP Professional Using Attended Installation Slide 11 of 17 Ver. 1.0 Querying, Managing, and Administering Databases using SQL Server 2005 Collaborative Session 4 Collaborate Session 5 In which different languages can you write managed code? You can write managed code by using Visual Basic, Visual C#, and Visual C++. FAQs (Contd.) ¤NIIT Instructor Inputs 5.9 Slide 12 Installing Windows XP Professional Using Attended Installation Slide 12 of 17 Ver. 1.0 Querying, Managing, and Administering Databases using SQL Server 2005 Collaborative Session 4 Collaborate Session 5 Challenge Which of the following is not a standard for Web service? UDDI HTML WSDL SOAP Answer: HTML Slide 13 Installing Windows XP Professional Using Attended Installation Slide 13 of 17 Ver. 1.0 Querying, Managing, and Administering Databases using SQL Server 2005 Collaborative Session 4 Collaborate Session 5 Challenge (Contd.) Which of the following requirements does an application need to meet to use a Web service? A standard format for designing a Web service A standard language for sending messages from the client application to the Web service A common data representation format of the data exchanged A mechanism to allow a Web service to locate a client Answer: A common data representation format of the data exchanged 5.10 Instructor Inputs ¤NIIT Slide 14 Installing Windows XP Professional Using Attended Installation Slide 14 of 17 Ver. 1.0 Querying, Managing, and Administering Databases using SQL Server 2005 Collaborative Session 4 Collaborate Session 5 Challenge (Contd.) Which of the following Web service standard describes a Web service? WSDL UDDI XML SOAP Answer: WSDL Slide 15 Installing Windows XP Professional Using Attended Installation Slide 15 of 17 Ver. 1.0 Querying, Managing, and Administering Databases using SQL Server 2005 Collaborative Session 4 Collaborate Session 5 Challenge (Contd.) Which of the following is a correct sequence of steps to secure HTTP endpoints? 1. Create appropriate user accounts within the database. 2. Grant permission for a stored procedure or user-defined functions that the user needs to access by using a Web service. 3. Grant permission to users to connect to HTTP endpoints. 1. Create appropriate user accounts within the database. 2. Grant permission to users to access HTTP endpoints. 3. Grant permission to users for a stored procedure or user- defined functions that the user needs to access by using a Web service. 1. Create appropriate user accounts within the database. 2. Grant permission for a database that the user needs to access by using a Web service. 3. Grant permission to users to connect to HTTP endpoints. [...]... is not present in a WSDL document? The Web service available for a given Web site The URL at which a Web service can be attached The format used to access the Web service The type of language that is used to create a Web service Answer: The type of language that is used to create a Web service Collaborative Session 4 Ver 1.0 NIIT Collaborate Session 5 Slide 17 of 17 Instructor Inputs 5.11 Solutions to... after performing data manipulations Discuss the different types of triggers that can be created by using SQL Server 2005 Instructor Inputs You can conduct the discussion as follows: Move the discussion toward the different types of triggers Encourage the students to discuss the new category of triggers called DDL triggers Solution The SQL Server supports the following types of triggers: Data Modification... format of the data exchanged a WSDL a i Create appropriate user accounts within the database ii Grant permission for a stored procedure or user-defined functions that the user needs to access by using a Web service iii Grant permission to users to connect to HTTP endpoints d The type of language that is used to create a Web service 5.12 Instructor Inputs NIIT Home Assignment 1 Which of the following. .. userdefined functions that the user needs to access by using a Web service 3 Grant permission to users to connect to HTTP endpoints Collaborative Session 4 Collaborate Session 5 Ver 1.0 Slide 16 of 17 Slide 17 Querying, Managing, and Administering Databases using SQL Server 2005 Installing Windows XP Professional Using Attended Installation Challenge (Contd.) Which of the following information is not... triggers? a They can be nested up to 35 levels b They can return values c They can be directly invoked d They can prevent incorrect and unauthorized changes in data 2 Harry has updated a record in a table that has an update trigger Which magic table/tables are used when a record is updated? a Inserted table b Updated table c Deleted table d Both inserted and deleted tables 3 Which of the following is... Challenge (Contd.) Which of the following is a correct sequence of steps to secure HTTP endpoints? 1 Grant permission for a stored procedure or user-defined functions that the user needs to access by using a Web service 2 Grant permission to users to connect to HTTP endpoints 3 Create appropriate user accounts within the database Answer: 1 Create appropriate user accounts within the database 2 Grant permission... trigger is fired when data in the underlying table is affected by DML statements, such as INSERT, UPDATE, or DELETE Depending on the operation that is performed, the DML triggers can be further categorized as: Insert trigger: Is fired whenever an attempt is made to insert a row in the trigger table Delete trigger: Is fired whenever an attempt is made to delete a row from the trigger table Update trigger:... level specifies that a transaction can read the data modified by the current transaction even before the modifications are committed? a READ UNCOMMITTED b READ COMMITED c REPEATABLE READ d SNAPSHOT 9 Which object is not created by using managed code? a Stored procedure b Table c Trigger d Function 10 Which authentication method uses MD5 hashing algorithm in the CREATE ENDPOINT statement? a BASIC b DIGEST... trigger d Delete trigger 5 Which property of ACID ensures that either all or none of the data modifications are performed? a Atomicity b Consistency c Isolation d Durability 6 Which problem occurs when two or more transactions try to modify the same row? a Phantom reads b Inconsistent analysis c Lost updates d Uncommitted dependency NIIT Instructor Inputs 5.13 7 Which lock allows concurrent transaction... 4 5 6 7 8 9 10 They can prevent incorrect and unauthorized changes in data Both inserted and deleted tables Database trigger Instead of trigger Atomicity Lost updates Shared locks READ UNCOMMITTED Table DIGEST 5.14 Instructor Inputs NIIT Collaborative Exercise At times, while performing data manipulation on a database object, you might also need to perform another manipulation on another object A trigger . Instructor Inputs Session 5 ¤NIIT Instructor Inputs 5. 3 This session includes the following topics: Web services Securing HTTP endpoints . Server 20 05 Collaborative Session 4 Collaborate Session 5 Challenge (Contd.) Which of the following Web service standard describes a Web service? WSDL UDDI XML SOAP Answer: WSDL Slide 15 Installing. 20 05 Collaborative Session 4 Collaborate Session 5 Challenge (Contd.) Which of the following information is not present in a WSDL document? The W eb service available for a given Web site. The