Module 2: Connecting to Data Sources. Overview Choosing a.NET Data Provider Defining a Connection Managing a Connection Handling Connection Exceptions.

Slides:



Advertisements
Similar presentations
Yukon – What is New Rajesh Gala. Yukon – What is new.NET Framework Programming Data Types Exception Handling Batches Databases Database Engine Administration.
Advertisements

ADO.NET: Working in Disconnected Environment Sergey Baidachni MCT, MCSD, MCDBA.
Visual Basic.NET A look into the.NET Programming Model Bryan Jenks Integrated Ideas ©2005.
Coding ADO.NET Objects: Connection, Command, DataReader.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
Security in SQL Jon Holmes CIS 407 Fall Outline Surface Area Connection Strings Authenticating Permissions Data Storage Injections.
Programming in ADO.NET: Data-Centric Applications and ADO.NET Original copyright by Microsoft, 2002, with minor modifications by Dan Eaves, 2005.
Objective In this session we will discuss about : What is ADO. NET ?
Chapter 10 Overview  Implement Microsoft Windows Authentication Mode and Mixed Mode  Assign login accounts to database user accounts and roles  Assign.
Overview of Database Access in.Net Josh Bowen CIS 764-FS2008.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
Microsoft ® Official Course Monitoring and Troubleshooting Custom SharePoint Solutions SharePoint Practice Microsoft SharePoint 2013.
Visual Basic.NET A look into the.NET Programming Model Bryan Jenks Integrated Ideas ©2005.
Stored Procedures Dr. Ralph D. Westfall May, 2009.
To define a class in Visual Basic.NET, you can follow this general procedure: 1. Add a class to the project. 2. Provide an appropriate file name for.
Introduction to SQL 2005 Security Nick Ward SQL Server Specialist Nick Ward SQL Server Specialist
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
Programming with Visual Basic.NET An Object-Oriented Approach  Chapter 8 Introduction to Database Processing.
Benefits of PL/SQL. 2 home back first prev next last What Will I Learn? In this lesson, you will learn to: –List and explain the benefits of PL/SQL –List.
Module 12 Handling Errors in T-SQL Code. Module Overview Understanding T-SQL Error Handling Implementing T-SQL Error Handling Implementing Structured.
Module 14: WCF Send Adapters. Overview Lesson 1: Introduction to WCF Send Adapters Lesson 2: Consuming a Web Service Lesson 3: Consuming Services from.
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
Module 7: Fundamentals of Administering Windows Server 2008.
Developing Web Applications Using Microsoft ® Visual Studio ® 2008.
Needs for Accessing Database To make your web site more dynamic and maintainable, you can display information on your web pages that are retrieved from.
Profiles, Password Policies, Privileges, and Roles
Module 9 Authenticating and Authorizing Users. Module Overview Authenticating Connections to SQL Server Authorizing Logins to Access Databases Authorization.
Chapter 3 Introduction to ADO.NET 3.1 The ADO and ADO.NET ActiveX Data Object (ADO) is developed based on Object Linking and Embedding (OLE) and Component.
Database, SQL, and ADO.NET- Part 1 Session 11 Mata kuliah: M0874 – Programming II Tahun: 2010.
BA372 Stored Procedures and Triggers Lab. What needs to be done to change a customer’s credit limit? Who am I? May I? Do it Log it Display A database.
Objectives In this lesson, you will learn to: *Identify the need for ADO.NET *Identify the features of ADO.NET *Identify the components of the ADO.NET.
10/26/20151 Chapter 3 Introduction to ADO.NET In this chapter, you will: Learn the basic classes in ADO.NET and its architecture Learn the different ADO.NET.
Module 9: Accessing Relational Data Using Microsoft Visual Studio.NET.
Session 8: ADO.NET. Overview Overview of ADO.NET What is ADO.NET? Using Namespaces The ADO.NET Object Model What is a DataSet? Accessing Data with ADO.NET.
Module 7: Accessing Data by Using ADO.NET
ADO.NET Data Access. Page  2 SQL  When we interact with the datasource through ADO.NET we use the SQL language to retrieve,modify,update information.
ASP.NET OPTIMIZATION. Why Optimize? $$$ Whether you build applications for customers or not, enhanced applications save money.
Managing users and security Akhtar Ali. Aims Understand and manage profiles Understand and manage users Understand and manage privileges Understand and.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Introduction to ADO.NET ADO.NET - Lesson 01  Training time: 10 minutes  Author:
An Introduction to ADO.Net Marmagna Desai.NET Seminar, Fall-2003.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 8 Advanced SQL.
Module 3: Performing Connected Database Operations.
ADO.NET Objects – Data Providers Dr. Ron Eaglin. Requirements Visual Studio 2005 Microsoft SQL Server 2000 or 2005 –Adventure Works Database Installed.
ADO.NET connections1 Connecting to SQL Server and Oracle.
1 11/10/05CS360 Windows Programming ADO.NET. 2 11/10/05CS360 Windows Programming ADO.NET  Behind every great application is a database manager o Amazon.
JDS – VB.NET Skill Session Fall 2004 Presented by YUHAO LIN.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 The SqlConnection Object ADO.NET - Lesson 02  Training time: 10 minutes 
Permissions Lesson 13. Skills Matrix Security Modes Maintaining data integrity involves creating users, controlling their access and limiting their ability.
ADO.NET AND STORED PROCEDURES - Swetha Kulkarni. RDBMS ADO.NET Provider  SqlClient  OracleClient  OleDb  ODBC  SqlServerCE System.Data.SqlClient.
Module 6: Data Protection. Overview What does Data Protection include? Protecting data from unauthorized users and authorized users who are trying to.
DAT430 Extending Microsoft ® ADO.NET Building a Custom Data Factory API DAT430 Extending Microsoft ® ADO.NET Building a Custom Data Factory API Gert E.R.
Accessing Data with Microsoft Visual C# Applications.
Database Security Cmpe 226 Fall 2015 By Akanksha Jain Jerry Mengyuan Zheng.
HNDIT Rapid Application Development
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
Module 4 Introduction ADO.NET.
1 Database Programming with ADO.NET Kashef Mughal.
Using ADO.Net to Build a Login System Dr. Ron Eaglin.
ADO.NET Objects Data Adapters Dr. Ron Eaglin. Agenda Builds on Information in Part I Should have working knowledge of creating a database connection Continuation.
Module 6: Administering Reporting Services. Overview Server Administration Performance and Reliability Monitoring Database Administration Security Administration.
Module 2: Using ADO.NET to Access Data. Overview ADO.NET Architecture Creating an Application That Uses ADO.NET to Access Data Changing Database Records.
Copyright Ó Oracle Corporation, All rights reserved Debugging Triggers.
Module 5: Managing Content. Overview Publishing Content Executing Reports Creating Cached Instances Creating Snapshots and Report History Creating Subscriptions.
ADO .NET from. ADO .NET from “ADO .Net” Evolution/History of ADO.NET MICROSOFT .NET “ADO .Net” Evolution/History of ADO.NET History: Most applications.
ASP.NET Programming with C# and SQL Server First Edition
Lecture 6 VB.Net SQL Server.
Deploying and Configuring SSIS Packages
A look into the .NET Programming Model
Presentation transcript:

Module 2: Connecting to Data Sources

Overview Choosing a.NET Data Provider Defining a Connection Managing a Connection Handling Connection Exceptions Connection Pooling

Lesson: Choosing a.NET Data Provider What Are.NET Data Providers? The.NET Data Provider Classes Which.NET Data Provider Should You Use?

What Are.NET Data Providers? Definition A.NET data provider is a set of classes that you use to connect to a data source, and retrieve and update data Types of.NET data providers SQL Server.NET Data Provider OLE DB.NET Data Provider ODBC.NET Data Provider Others

The.NET Data Provider Classes XxxConnection – for example, SqlConnection XxxTransaction – for example, SqlTransaction XxxException – for example, SqlException XxxError – for example, SqlError XxxCommand – for example, SqlCommand XxxParameter – for example, SqlParameter XxxDataReader – for example, SqlDataReader XxxDataAdapter – for example, SqlDataAdapter XxxPermission – for example, SqlClientPermission

Which.NET Data Provider Should You Use? SQL Server.NET Data Provider SQL Server version 7.0 or later OLE DB.NET Data Provider SQL Server 6.5, Microsoft Access, Oracle, other data sources with OLE DB providers ODBC.NET Data Provider Legacy data sources that only have ODBC drivers Guidelines for choosing a.NET data provider

Lesson: Defining a Connection Database Security What Is a Connection String? How to Set a Connection String

Database Security Using SQL Server security Windows Authentication Secure validation and encryption Auditing Password expiration and minimum length Account lockout Mixed Mode (Windows Authentication and SQL Server authentication) Primarily for backward compatibility

What Is a Connection String? A connection string defines the parameters required to make a connection to a data source Connection string parameters Provider (OLE DB only) Data Source Initial Catalog Integrated Security User ID/Password Persist Security Info

How to Set a Connection String You can set the ConnectionString property only when the connection is closed To reset a connection string, you must close and reopen the connection Microsoft Access connection Dim cnNorthwind As New _ System.Data.OleDb.OleDbConnection() cnNorthwind.ConnectionString = _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=\Samples\Northwind.mdb;“ Practice Visual Basic ExampleC# Example

Lesson: Managing a Connection Opening and Closing a Connection Handling Connection Events

Opening and Closing a Connection Opening and closing connections explicitly Open and Close methods Opening and closing connections implicitly Data adapters can open and close connections automatically when needed Using the Dispose method Removes the connection from the connection pool Visual Basic Example

Handling Connection Events Connection events StateChange and InfoMessage StateChangeEventArgs class Provides data for the state change event of a.NET data provider CurrentState and OriginalState properties are read-only Visual Basic code sample Private Sub cnNorthwind_StateChange( _ ByVal sender As Object, _ ByVal e As System.Data.StateChangeEventArgs _ ) Handles cnNorthwind.StateChange Practice Visual Basic ExampleVisual C# Example

Lesson: Handling Connection Exceptions What Is Structured Exception Handling? How to Handle SqlExceptions How to Handle the InfoMessage Event

Handling Exceptions Syntax of the Try… Catch… Finally statement Handling multiple exception types What are generic exceptions? Practice Visual Basic SyntaxVisual Basic Example

How to Handle SqlExceptions Write the code to execute inside a Try block Write a Catch statement for each specific exception that you want to catch System.Data.SqlClient.SqlException Errors collection SqlError properties (Class, Number) Write a generic Catch statement for all other exceptions Write a Finally statement to run the code no matter what happens End the exception handler with an End Try block Practice Visual Basic Example

How to Handle the InfoMessage Event The InfoMessage event is triggered when a SQL Server raises an error of severity level These are not fatal errors InfoMessageEventArgs Errors collection SqlError Generated by the T-SQL Print statement Useful for debugging stored procedures Practice

Lesson: Connection Pooling What Is Connection Pooling? Controlling OLE DB Connection Pooling Controlling SQL Server Connection Pooling Demonstration: Monitoring SQL Server Activity

What Is Connection Pooling? Connection pooling is the process of keeping connections active and pooled so that they can be efficiently reused. How connection pooling works Example of connection pooling Visual Basic Example

Multimedia: How SQL Server Connection Pooling Works This animation describes how connection pooling works with Microsoft SQL Server 2000

Controlling OLE DB Connection Pooling Enabled by default To disable OLE DB connection pooling: Dim cnNorthwind As New OleDbConnection() cnNorthwind.ConnectionString = _ "Provider=SQLOLEDB;" & _ "Data Source=London;" & _ "Integrated Security=SSPI;" & _ "OLE DB Services=-4;" & _ "Initial Catalog=Northwind;"

Controlling SQL Server Connection Pooling Connection string parameters for connection pooling Connection Lifetime Connection Reset Enlist Max Pool Size Min Pool Size Pooling Visual Basic Example

Demonstration: Monitoring SQL Server Activity Creating a SQL Server Profiler trace Monitoring SQL Server activity

Review Choosing a.NET Data Provider Defining a Connection Managing a Connection Handling Connection Exceptions Connection Pooling

Lab 2.1: Connecting to Data Sources Exercise 1: Creating a Connection to Microsoft SQL Server Exercise 2: Handling Common Connection Exceptions Exercise 3: Monitoring and Managing Connection Pooling with SQL Server Exercise 4 (Optional): Creating a Connection to an OLE DB Data Source