Oracle & SQL Server in a .NET World

Slides:



Advertisements
Presentazioni simili
IBM System i Il Sistema Enterprise per la PMI
Advertisements

Elaborazione di Franco Grivet Chin
Accesso ai dati su Relational Database Management Systems LSA - Laboratorio di Sistemi Informativi Economico-Aziendali Salvatore Ruggieri Dipartimento.
JDBC: Concetti Fondamentali Lorenzo Blanco
Corrado Cavalli Microsoft .NET MVP
1 / 70 ADO.NET, i Data Provider e l'architettura connessa Silvano Coriani Developer & Platform Evangelism MCTrainer MCSDeveloper MCADeveloper MCSEInternet.
Crea il tuo sito con Web Matrix e il Web Hosting su ASP.NET
Midrange Modernization Conference 1 Scenari evolutivi per le soluzioni basate su AS/400 Walter Poloni Direttore Developer & Platform Evangelism Microsoft.
TechNet Integration Workshop
Microsoft Visual Studio 2005: come è cambiata lofferta degli strumenti di sviluppo Giada Scarafiotti – Developer.
Luca Bianchi Windows Development Day Bologna 28 gennaio 2005 SQL Server Desktop Engine (MSDE) & SQL Server 2005 Express.
Sql Server 2005 Reporting Services - Sviluppo Franco Perduca Factory Software
ASP.NET – Data Binding Davide Vernole .NET MVP.
ASP.NET – Web Forms Davide Vernole.NET MVP. Di cosa parleremo Introduzione ad ASP.NET ASP.NET, dietro le quinte Componenti principali di una applicazione.
Sql Server 2005 Integration Services - Introduzione Franco Perduca Factory Software
Massimiliano Bosco – Aliware – Torino – Project 2003 Sviluppare Soluzioni EPM con Project Server (2/4)
Vincenzo Campanale PM Security & Management System Center, DSI e la Roadmap.
SQL (Standard query language) Istruzioni per la creazione di una tabella: Create table ( tipo, (, [vincoli]) Primary key ( ) CHIVE PRIMARIA Foreign key(
JPA Overview della tecnologia. Java Persistence Architecture Definita nella JSR-220 EJB 3.0 ( Tentativo di unificare EJB2.1 con.
E Windows SharePoint Services 2.0 Ivan Renesto Overview how to use Windows SharePoint Services.
Un DataBase Management System (DBMS) relazionale client/server.
Microsoft Robotics Studio Marco Petrucco Microsoft Student Partner - Udine.
EJB Enterprise Java Beans B. Pernici. Approccio Java.
Unified Modeling Language class C {…} class B extends C {…} Esiste una notazione grafica per mostrare le relazioni di ereditarietà. Object StringC B Tutte.
prompt> java SumAverage
Directory services Directory offline –Elenchi telefonici –Guide TV –Cataloghi acquisti Directory online –Application specific (lotus notes, MS Exchange.
Introduzione alle griglie computazionali - a.a LEZIONE LEZIONE N. 12 Grid Monitoring modello GMA GridICE GridICE demo Introduzione alle griglie.
1. Conoscere luso delle collezioni in Java Comprendere le principali caratteristiche nelle varie classi di Collection disponibili Saper individuare quali.
Citrix Metaframe. Metaframe è la soluzione client-server prodotta dalla Citrix in grado di rendere disponibili applicazioni e desktop a qualsiasi dispositivo.
Application Code Dato Table Data Base Trigger Code 1° Controllo Procedure Client Side 3° Controllo Integrity Constraint 2° Controllo Event Driven BUSINESS.
SQL Esercitazione per il corso “Basi di Dati” Gabriel Kuper
Università La Sapienza Ingegneria del Software I 1 Ingegneria del software I Seminario 2: Microsoft.NET.
FONDAMENTI DI INFORMATICA III WfMC-1. FONDAMENTI DI INFORMATICA III WfMC-2 WFMC Cose WfMC Workflow Management Coalition (WfMC), Brussels, è unorganizzazione.
JDBC(TM) Database Access
Sequence. CREARE UNA SEQUENCE CREATE SEQUENCE nome [INCREMENT BY n] [START WITH n] [MAXVALUE n | NOMAXVALUE] [MINVALUE n | NOMINVALUE] [CYCLE | NOCYCLE]
Componenti dell’architettura Oracle
SQL Server 2012 LocalDB.
Palermo, may 2010 F.Doumaz, S.Vinci (INGV-CNT- Gruppo di telerilevamento)
Attribution-NonCommercial-ShareAlike SQL Server.
Università degli studi di Modena e Reggio Emilia Facoltà di Ingegneria di Modena Corso di Laurea Specialistica in Ingegneria Informatica Analisi e valutazione.
Filtered Index and Statistics Filtered Indexes Sergio Govoni
Project Review byNight byNight December 6th, 2011.
WPF per il client Desktop
Fabio Cozzolino Vito Arconzo
3/29/2017 3:05 AM ©2005 Microsoft Corporation. All rights reserved.
Microsoft SQL Server Versioni di Microsoft SQL Server 2005 SQL Server EXPRESS Edition SQL Server MOBILE Edition SQL Server WORGROUP Edition SQL.
Attribution-NonCommercial-ShareAlike Le novità
Attribution-NonCommercial-ShareAlike Le novità
SQL SERVER Modulo 4 Relatore: Stefano Furlan. Sommario Criteri per scrivere del buon codice TSQL Con cenni a Indici e performances Breve carrellata di.
Scoprirete che su Office non si può solo contare ma anche sviluppare.
IIS7 Media Services Piergiorgio Malusardi IT Pro Evangelist
VB.NET Sviluppo Applicazioni Desktop
Visual Studio Tools for Office: Developer Solutions Platform Fulvio Giaccari MCSD.NET / MCT Responsabile Usergroup ShareOffice Blog:
SQL Server 2005 Sicurezza Davide Mauri Factory Software
Project Review Novembrer 17th, Project Review Agenda: Project goals User stories – use cases – scenarios Project plan summary Status as of November.
Maurizio Fermeglia ACCESSO AI DATI Maurizio Fermeglia
SUBQUERY Chi ha un salario maggiore di quello di Abel? Occorre scomporre la query in due sotto problemi: MAIN : quali impiegati hanno un salario maggiore.
Corso di Web Services A A Domenico Rosaci Patterns di E-Business D. RosaciPatterns per l'e-Business.
Dato Table Data Base Application Code 1° Controllo Procedure Client Side 3° Controllo Integrity Constraint Trigger Code 2° Controllo Event Driven BUSINESS.
1 Basi di dati (Sistemi Informativi) Scuola di Dottorato in Scienze Veterinarie per la Salute Animale e la Sicurezza Alimentare a.a Ing. Mauro.
Collection & Generics in Java
SQL Developer Lanciare sqldeveloper (alias sul desktop) / c:\Oracle\sqldeveloper Associare tutti i tipi di file, se volete Tasto destro sulla spina “connection”
Azure: Mobile Services e Notification Hub ANDREA GIUNTA.
Dynamic SQL.
JDBC Java DataBase Connectivity SISTEMI ITIS B. CASTELLI Anno Scolastico
Nuove funzionalitA’ e caratteristiche del linguaggio
Real World data access layers DataSet vs. Custom entities Pierre Greborio Software Architect – PEWay SrL Microsoft MVP – Solutions Architect.
Sviluppo per Pocket PC con SQL Server CE 2.0 Fabio Santini Silvano Coriani.NET Developer Evangelist Microsoft Corporation.
WPC034 - Visual Studio Code: sviluppare su Linux, Mac OS e Windows
Studente : Andrea Cassarà Classe: 5AII A.S. 2014/2015 Link Sito
Transcript della presentazione:

Oracle & SQL Server in a .NET World 3/27/2017 2:28 AM Oracle & SQL Server in a .NET World Silvano Coriani (silvano.coriani@microsoft.com Developer Evangelist Microsoft © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Agenda Il miglior RDBMS per .NET  Microsoft SQL Server 2005 Ok, ok…viviamo in un mondo “meticcio”  Oracle 8i/9i/10g (10.1.0,10.2.0) IBM DB2 UDB 8.2.2 .NET Development Problemi simili, ambienti e soluzioni diverse Best practices e dintorni

RDBMS su Windows Intendiamoci… Microsoft SQL Server 2005 è il miglior RDBMS su Windows Miglior TPC-C su hw commerciale (x86-IA64) Migliori risultati su 2-4-6 processori (x86) Ha il Query Processor più evoluto Miglior integrazione con la piattaforma di sviluppo Semplicità di gestione “Auto-everything” da sempre News con la versione 2005 Uno Storage Engine all’altezza di qualsiasi confronto Nuovi servizi integrati come il Broker, Notifications, ecc.

RDBMS su Windows Ma non siamo soli…  Oracle, dalla 8i alla 10g (10.2.0) Pro (cosa gli invidio) La reputazione  e il know how Lo storage engine Contro Query Proc “solido” ma non particolarmente smart Costi licenze comunque elevati, e componenti aggiuntive a pagamento Complessità di gestione (capacity planning, installazione, tuning, amministrazione) IBM DB 2 Pro Query proc decisamente interessante Il TPC-C benchmark su AIX e POWER5  Versioni differenti sulle diverse piattaforme Funzionalità, comportamenti, modelli di programmazione Strumenti di gestione “incoerenti” Servizi poco integrati tra di loro

RDBMS su Windows Ma in Oracle si fa…. come faccio in SQL Server? Nello Storage Engine di SQL Server 2005 ci sono novità per i DEV che utilizzano normalmente Oracle Snapshot Isolation (e Read Committed S.I.) Data & index partitioning È stato aggiunta la funzione ROW_NUMBER() per numerare i record di un resultset (evvai con le paginazioni!)  Altre tecniche di programmazione tipiche del mondo Oracle possono essere facilmente imitate con SQL Server Ad esempio le famigerate Sequence

Estendere il DBMS “dall’interno” con .NET SQL Server 2005 integra il CLR per estendere il DBMS Sia Oracle che DB2 consentono l’utilizzo di estendere il motore relazionale con il codice managed, in modalità diverse Utilizzano la v1.1 del CLR Integrazione molto diversa rispetto a SQL Server 2005 Semplice hosting attraverso le interfacce COM del CLR Nessun utilizzo degli host attributes della v2.0 per garantire la stabilità dell’hoster (utilizzo delle risorse, gestione eccezzioni, ecc.) Es. Oracle CLR Host

Windows Development Environment Support 3/27/2017 2:28 AM Windows Development Environment Support Oracle Developer Tools for VS.NET IIS (ASP ASP.NET) MTS/ COM+ C++, C#, VB .NET Application Develop Deploy Visual Studio Environment Application IIS Deploy Database Development ODP.NET Oracle DB Extensions For .NET Oracle Services for MTS © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Sviluppare applicazioni “client” con .NET Strumenti .NET Data Providers di Microsoft, Oracle e IBM Oracle Developer Tools for Visual Studio .NET IBM DB2 Tools for Visual Studio .NET Reusable code Enterprise Library Data Access Application Blocks Oracle DB2 Problemi aperti Differenti dialetti SQL Ma standard ANSI-SQL 92 più o meno rispettato Differenti funzionalità Sequence, Locking model, Stored Proc, supporto XML, ecc. ecc.

Oracle e .NET sul client Microsoft .NET Data Provider per Oracle 3/27/2017 2:28 AM Oracle e .NET sul client Microsoft .NET Data Provider per Oracle Prodotto da Microsoft Usa gli strumenti client di Oracle Oracle Data Provider per .NET (ODP.NET) Sviluppato da Oracle Integrazione completa Espone tutte le caratteristiche di un Oracle DB Oracle Connect per .NET (DataDirect) Altri metodi di accesso OLE DB .NET via OLE DB ODBC .NET via ODBC © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

ODP.NET Basics Disponibile gratuitamente Supporta VS.NET 2002 e 2003 .NET Developer Center http://www.oracle.com/technology/tech/dotnet/index.html Può essere usato con Oracle8, Oracle8i, Oracle9i, e Oracle10g Il database server può essere su Unix, Linux, Windows, etc. Client basato su .NET Supporta VS.NET 2002 e 2003 Supporta .NET Framework 1.0 e 1.1 © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

.NET Data Providers 3/27/2017 2:28 AM Your choices for connecting to Oracle with ADO.NET consist of the OleDb data provider, the Odbc data provider, or a native data provider. When you use the OleDb or Odbc data providers, there's an extra level of indirection through the OLE DB provider or ODBC driver. Microsoft's and Oracle's data providers use the OCI libraries; DataDirect's driver uses the TNS protocol directly. © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

ODP.NET Layer Layer Connesso Dati Disconnesso (ODP.NET) DataSet Oracle 3/27/2017 2:28 AM ODP.NET Layer Disconnesso Layer Connesso (ODP.NET) Dati Oracle DataAdapter OracleCommand Builder DataSet Oracle DataReader Oracle Command Oracle Transaction Oracle Connection Oracle © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

ODP.NET Supporto completo a PL/SQL Data type nativi Oracle 3/27/2017 2:28 AM ODP.NET Supporto completo a PL/SQL Packaged, non-packaged, anonymous, autonomous *Batch SQL disponibile con anonymous PL/SQL Data type nativi Oracle LOBS, REF Cursors, BFiles, N-data types, Dates, TimeStamps, Longs, Raws, etc. Mapping con tipi .NET *Connection pooling Min, Max, Timeout, Lifetime, Increment, Decrement © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Integrazione con Visual Studio .NET 3/27/2017 2:28 AM Integrazione con Visual Studio .NET Dynamic Help Documentazione ODP.NET – F1 key Server Explorer Tables, views, e synonyms Query e view designer Stored procedures, functions, triggers, package bodies, package specifications Execute, create, delete Intellisense Drag-and-drop da Data toolbox © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

.NET e Oracle ADO.NET VS.NET 2003 ASP.NET Web Services ODBC.NET OleDB 3/27/2017 2:28 AM .NET e Oracle ADO.NET ODBC.NET OleDB Oracle ODP.NET VS.NET 2003 ASP.NET Web Services How to access Oracle through .NET? Classic ADO with COM interop. ADO.NET and its various Providers Visual Studio .NET 2003—code-named Everett and based on .NET version 1.1—adds significant new features to the GUI-based designer tools for Oracle databases. These features appear in the Server Explorer and in the drag-and-drop items in the Visual Studio Data toolbox tab. You'll notice the difference whether you use the Oracle 8i or the Oracle 9i database, but I'll concentrate on explaining how to use these features with 9i, because the improvements are much more noticeable if you work with this version. © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Usare ADO.NET con Oracle 3/27/2017 2:28 AM Usare ADO.NET con Oracle Imports System.Data Imports System.Data.OracleClient Sub Main() Dim conn as New OracleConnection() conn.ConnectionString = _ "data source=zzz;" & _ "user id=scott;password=tiger" Try conn.Open() Console.WriteLine("Hello Oracle") Catch e as Exception Console.WriteLine("Failed connect") Finally If conn.State = _ ConnectionState.Open Then conn.Close() End If conn.Dispose() End Try End Sub Sub UseDataReader() Dim conn as New OracleConnection() conn.ConnectionString = _ "data source=symbolicname;" & _ "user id=scott;password=tiger" Dim cmd As New OracleCommand( _ "select * from emp", conn) Dim rdr As OracleDataReader Try conn.Open() rdr = cmd.ExecuteReader() While rdr.Read = True Console.WriteLine( _ "empno = {0}, ename = {1}", _ rdr("empno"), rdr("ename")) End While Catch e As Exception Console.WriteLine(e.Message) Finally If conn.State = _ ConnectionState.Open Then conn.Close() End If cmd.Dispose() conn.Dispose() End Try End Sub This simple program executes a SQL SELECT statement and retrieves a resultset through an OracleCommand and OracleDataReader. Note that you should call Dispose on the OracleCommand, as well as the OracleConnection, when you're finished with it. © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

3/27/2017 2:28 AM Oracle e i DataSet Sub UseDataSet() Dim ds As New DataSet() Dim da As New OracleDataAdapter( _ "select * from emp", _ "data source=zvm43;" & _ "user id=tiger;password=tiger") Dim bld As New OracleCommandBuilder(da) Try da.Fill(ds, "emp") Dim r As DataRow For Each r In ds.Tables(0).Rows Console.WriteLine( _ "empno = {0}, ename = {1}", _ r("empno"), r("ename")) Next ' Change a row and call Update ds.Tables(0).Rows(0)(2) = "JONES" da.Update(ds, "emp") Catch e As Exception Console.WriteLine(e.Message) End Try End Sub © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

3/27/2017 2:28 AM Query parametriche “Select * from emp where empno > ?” (ODBC,OleDB,DataDirect) “Select * from emp where empno > @enumber” (System.Data.SqlClient) “Select * from emp where empno > :enumber” (System.Data.OracleClient) Sub UseParmQuery() Dim conn As New OracleConnection( _ "data source=zmv43;" & _ "user id=scott;password=tiger") Dim cmd As New OracleCommand( _ "select * from emp " & _ "where empno > :thenumber", conn) cmd.Parameters.Add("thenumber", 7000) Dim rdr As OracleDataReader Try conn.Open() rdr = cmd.ExecuteReader() While rdr.Read = True Console.WriteLine( _ "empno = {0}, ename = {1}", _ rdr("empno"), rdr("ename")) End While Catch e As Exception Console.WriteLine(e.Message) Finally If conn.State = _ ConnectionState.Open Then conn.Close() End If cmd.Dispose() conn.Dispose() End Try End Sub © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Funzionalità specifiche ODP.NET 3/27/2017 2:28 AM Funzionalità specifiche ODP.NET Stessi nomi di classi dei provider Microsoft e DataDirect Ottimizzazioni sulle connessioni Gestione dei Savepoint nelle transazioni locali e distribuite REF CURSORs BLOB, CLOB, BFILE Use the Oracle Data Provider for .NET (ODP.NET) to extend the base ADO.NET interfaces and base classes to put almost all the functionality the Oracle database offers within reach. ODP.NET allows you to expose Oracle-specific behaviors and optimize access in Oracle-specific .NET applications. Using database-specific ADO.NET data providers is almost always preferable to using the OLE DB and ODBC bridge providers (see the sidebar, "Let a Hundred Providers Bloom"). However, writing optimized code for the target database requires you to understand how different data providers work. I will examine ODP.NET's features and compare it to the SqlClient data provider. Along the way, I'll explain downloadable program examples that put ODP.NET to use. This article is based on the 1.0 release of ODP.NET (see Additional Resources). ADO.NET data providers implement provider-specific classes that implement common interfaces. Some of these classes extend base classes in the .NET Framework. The dataprovider classes implemented in ODP.NET are part of the Oracle.DataAccess.Client namespace (see Table 1). A data provider must also map database data types to the .NET type system (see the sidebar, "Use ODP.NET to Help Map Data Types"). It can expose database-specific classes to map more closely if no .NET types are an exact fit. ODP.NET exposes a series of extended data types in the Oracle.DataAccess.Types namespace. Some of these are implemented as value types (structures, in C#), because .NET value types provide optimizations over making every type a class; others are implemented as reference types (classes) (see Figure 1). ODP.NET supports two types of special data-related classes in the Oracle.DataAccess.Types namespace. Large objects and REF CURSOR types are Object types derived from System.Stream. The remaining special types are derived from System.ValueType to take advantage of stack-based allocation semantics. ODP.NET's optimizations for accessing Oracle functionality start at the beginning—the connection. The easiest way to optimize connections in a three-tier environment is by pooling. Unlike the bridge providers, which use OLE DB or ODBC's built-in connection pooling, ODP.NET allows you to specify pooling parameters on the connection string. Use the Max Pool Size and Min Pool Size parameters to specify the maximum and minimum number of open connections in a pool. If you set ODP.NET's Min Pool Size to 5, the provider opens a single connection the first time Connection.Open is called, returns to the caller immediately, then uses a background thread to open the other four connections. If a pool is at Max Pool Size, the provider (and the caller) wait for the amount of time specified in OracleConnection.ConnectionTimeout for a connection to become available. The default value for ConnectionTimeout is 15 seconds. An exception is raised if no connection is available at that point. You can also use the Increment and Decrement connection string parameters to specify the number of connections that are opened or closed at a time, when the number of connections falls between MinPoolSize and MaxPoolSize. © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

REF CURSOR come Resultset 3/27/2017 2:28 AM REF CURSOR come Resultset OracleConnection conn = new OracleConnection( "data source=zmv43;user id=scott;password=tiger"); OracleCommand cmd = new OracleCommand("Employes.GetEmpRecords", conn); cmd.CommandType = CommandType.StoredProcedure; conn.Open(); cmd.Parameters.Add("p_cursor", OracleDbType.RefCursor); cmd.Parameters.Add("j_cursor", OracleDbType.RefCursor); cmd.Parameters.Add("indeptno", OracleDbType.Decimal); cmd.Parameters.Add("p_errorcode", OracleDbType.Int32); cmd.Parameters[0].Direction = ParameterDirection.Output; cmd.Parameters[1].Direction = ParameterDirection.Output; cmd.Parameters[2].Value = 10; cmd.Parameters[3].Direction = ParameterDirection.Output; OracleDataReader rdr = cmd.ExecuteReader(); // fetch output parm Console.WriteLine(cmd.Parameters[3].Value); do { while (rdr.Read()) Console.WriteLine(rdr[0]); } while (rdr.NextResult() == true); © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

ExecuteNonQuery e REF CURSORS 3/27/2017 2:28 AM ExecuteNonQuery e REF CURSORS // Connection and parameter setup as above ... int i = cmd.ExecuteNonQuery(); // cast to obtain both REF CURSORs as DataReaders OracleDataReader rdr1 = ((OracleRefCursor)cmd.Parameters[0].Value).GetDataReader(); OracleDataReader rdr2 = ((OracleRefCursor)cmd.Parameters[1].Value).GetDataReader(); // use both REF CURSORs at the same time while ((rdr1.Read()) && (rdr2.Read())) { Console.WriteLine(rdr1.GetName(0) + " = " + rdr1[0]); Console.WriteLine(rdr2.GetName(0) + " = " + rdr2[0]); } © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

ODP.NET e XML *XML XMLType data type Query XML dal DB 3/27/2017 2:28 AM ODP.NET e XML *XML XMLType data type Query XML dal DB Sia su tabelle relazionali che object-relational Interoperabilità con MS XML API (es. XmlReader) Supporta XSLT e XPATH There features are not available to ADO, OLE DB .NET, nor ODBC .NET users: ODP.NET XML APIs XML DB is a high performance XML storage and retrieval technology in the Oracle DB. XML DB stores XML natively in the DB with its own data type, XMLType. ODP.NET exposes XMLType as a native type within .NET to manipulate XML and share XML with Microsoft’s XML services, such as XMLReader. ODP.NET can access relational and object-relational data as XML with the ability to query and save XML from the database easily. * Performance tip © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

ODP.NET e XML Richiede Oracle8i, Oracle9i, o Oracle 10g DB XML DB 3/27/2017 2:28 AM ODP.NET e XML Richiede Oracle8i, Oracle9i, o Oracle 10g DB Può richiedere XML Developer’s Kits (XDK) sul server XML DB Non è indispensabile ma raccomandato Disponibilità di OracleXmlType Possibilità di utilizzare Schema XML © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Classi ODP.NET XML OracleXmlType OracleXmlStream Dati XMLType nativi OracleXmlStream Stream XML read-only OracleXmlQueryProperties OracleXmlSaveProperties © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

ODP.NET Transazioni Globalization Transparent application failover 3/27/2017 2:28 AM ODP.NET Transazioni Utilizzo degli Enterprise Services via Oracle Services for MTS Locali (Implicite e esplicite) Savepoints Globalization Supporto completo a Unicode Utilizzo delle impostazioni internazionali dei client Transparent application failover Callback di notifica Here are some of the ODP.NET features that were not previously available to ADO, OLE DB .NET, nor ODBC .NET users: Local transaction savepoints Globalization Transparent application failover (TAF) notification Savepoints creates intermediate points to which transactions can be rolled back to. That way, transactions do not need to be rolled back entirely, but can be rolled back partially. This reduces the time it takes for transaction recovery to occur. Savepoints are set off of the ODP.NET Transaction object. ODP.NET fully supports Unicode, which is important for making your applications available internationally. Moreover, globalization support allows developers to develop one set of code for any culture/language setting. ODP.NET globalization extracts the client computer’s national language setting to display information in the proper format. For example, a Japanese application can be deployed that shows currency in yen. Without having to do any new coding, that same application can be deployed in Germany and show deutsche marks. TAF notification allows ODP.NET developers to register TAF events that occur in the DB. TAF events allow developers to build more robust and interactive applications during DB connection loss and recovery. * Performance tip © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Best Practice - Connection 3/27/2017 2:28 AM Best Practice - Connection Utilizzare il connection pooling Ma attenzione al numero di connessioni nel pool (nell’ultima versione di ODP.NET abbiamo pieno controllo) Attenzione alle stringe di connessione Non generare pool differenti Utilizzare forme di autenticazione “proxy” © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Best Practice - Connection 3/27/2017 2:28 AM Best Practice - Connection Validate Connection Garantisce una connessione valida, ma al prezzo di un extra round trip Forse meglio crearsi il proprio exception handler Utilizzare correttamente gli oggetti ODP.NET (e.g. OracleConnection) Chiamare Dispose() quando non più utilizzati © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Best Practice – Letture e aggiornamenti Concetto base: controllare i roundtrip verso il database Recuperare solo i dati necessari, solo quando necessario SELECT Usare FetchSize (OracleDataReader) e RowSize (OracleCommand) per controllare la dimensione dei dati ritornati Utilizzare DataAdapter Requery Evita DB round trip © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Best Practice – Letture e aggiornamenti Multi-statement (in un roundtrip) Eseguire più statement batch differenti Attraverso anonymous PL/SQL Unico roundtrip, resultset differenti Stesso set di comanti più volte? Utilizzare statement caching Riutilizzo di comandi SQL o PL/SQL Ok anche quando il valore dei parametri cambia © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Best Practice – Letture e aggiornamenti Multi-statement Eseguire lo stesso comando più volte? Utilizzare il parameter array binding Il comando verrà eseguito una volta per ogni valore dell’array, ma in un unico roundtrip Limitazioni nell’utilizzo di SELECT statement, tipicamente adatto ad operazioni di insert/update Passare un array? Utilizzare gli array associativi di PL/SQL Il comando verrà eseguito una sola volta per l’intero array Ok anche per comandi di SELECT Parameter array binding Più semplice degli array associativi Ma gli array associativi hanno migliori performance e funzionalità avanzate © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Best Practice – Data Type 3/27/2017 2:28 AM Best Practice – Data Type Concetto base: controllare i roundtrip Utilizzare I tipi esposti da ODP.NET (es. OracleClob) Utilizzare OracleRefCursor Recupero dei dati solo quando necessario Utilizzare Oracle LOB (DML) No roundtrip aggiuntivi per aggiornare o inserire LOB © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Best Practice – Data Type 3/27/2017 2:28 AM Best Practice – Data Type Usare Oracle LOB (SELECT) Devo leggere tutto il LOB? InitialLOBFetchSize e InitialLongFetchSize per controllare l’attività Devo leggerne solo una parte? Proprietà Read per controllare la quantità di dati letti per roundtrip Devo leggere il contenuto successivamente? Di default, ODP.NET LOBs utilizzano puntatori agli oggetti sul server e non necessitano di rileggere interamente gli oggetti © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Approfondimenti .NET Developer Center Portale Oracle su Windows 3/27/2017 2:28 AM Approfondimenti .NET Developer Center http://www.oracle.com/technology/tech/dotnet/index.html Portale Oracle su Windows http://www.oracle.com/technology/tech/windows/index.html © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

(partitioned across a cluster) 3/27/2017 2:28 AM .NET e la famiglia DB2 DB2 for zOS DB2 (partitioned across a cluster) DB2 (Linux for zSeries) .NET Application DB2 for VSE & VM DB2 (Windows & Linux) DB2 for iSeries DB2 (Linux for iSeries) DB2 Everyplace © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

OLE DB .Net Data Provider 3/27/2017 2:28 AM DB2 e ADO.NET sul client Application System.Data.OleDb Application Microsft.Data.ODBC Application IBM.Data.DB2 OLE DB .Net Data Provider OleDbConnection OleDbCommand OleDbAdapter OleDbDataReader ODBC .Net Data Provider OdbcConnection OdbcCommand OdbcDataAdapter OdbcDataReader DB2 .Net Data Provider DB2Connection DB2Command DB2DataAdapter DB2DataReader IBM DB2 OLE DB Provider IBM DB2 ODBC Driver DB2 © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Data Provider per DB2 ODBC .NET Data Provider 3/27/2017 2:28 AM Data Provider per DB2 ODBC .NET Data Provider Per .NET Framework v1.0: Namespace = Microsoft.Data.Odbc download from MSDN per .NET Framework v1.1: Namespace = System.Data.Odbc OLE DB .NET Data Provider Namespace = System.Data.Oledb IBM DB2 .NET Data Provider Namespace = IBM.Data.DB2 Parte del DB2 Run-Time Client V8.1.2 © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Modalità disconnessa System.Data IBM.Data.DB2 WinForm DataSet 3/27/2017 2:28 AM Modalità disconnessa System.Data IBM.Data.DB2 DB2 WinForm DataSet Table Data Adapter Data Adapter DB2 Data Adapter WebForm SQL Server Data Adapter Mobile WebForm Other Data Adapter © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

DB2Connection Object Supporto per connection pooling 3/27/2017 2:28 AM DB2Connection Object Supporto per connection pooling Può partecipare a transazioni distribuite Ricordarsi di chiudere la connessione quando finito il lavoro!!! ' set a connection string and connect to SAMPLE database ' using DB2 .NET Data Provider Dim connectionString = "Database=SAMPLE" Dim cnn As New DB2Connection(connectionString) cnn.Open() ' Use the connection in here… If cnn.State = ConnectionState.Open Then cnn.Close() End If © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

DB2Command Object Per comandi SQL statements o stored procedure 3/27/2017 2:28 AM DB2Command Object Per comandi SQL statements o stored procedure Command Object: ExecuteReader – ritorna un DataReader ExecuteNonQuery – non ritorna nulla ExecuteScalar – ritorna il primo valore scalare ' create a DB2Command with a SELECT statement Dim db2SelectCommand As New IBM.Data.DB2.DB2Command() db2SelectCommand.CommandText = "Select * from Customers" db2SelectCommand.Connection = myDB2Connection © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

DB2DataReader Object Cursore forward-only, read-only 3/27/2017 2:28 AM DB2DataReader Object Cursore forward-only, read-only Solo il record corrente in memoria ExecuteReader Chiudere per liberare la connessione Dim cnn As New DB2Connection(conDB2ConnectionString) Dim strSQL As String = "SELECT * FROM Department" Dim cmd As New DB2Command(strSQL, cnn) Dim dr As DB2DataReader cnn.Open() dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) Do While dr.Read lstDept.Items.Add(String.Format("{0}: {1}, {2}", _ dr(“DEPTNO"), dr(“DEPTNAME"), dr(“MGRNO"))) Loop dr.Close() © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Chiamare Stored Procedure Attraverso l’oggetto Command Gestione dei parametri Dim dr As DB2DataReader Dim cnn As New DB2Connection(conDB2ConnectionString) Dim cmd As New DB2Command(“SomeSP", cnn) cnn.Open() cmd.CommandType = CommandType.StoredProcedure Dim prm As DB2Parameter = _ cmd.Parameters.Add(“SomeParam", “Foo") dr = cmd.ExecuteReader() While dr.Read lstDemo.Items.Add(String.Format( _ "{0}: {1}", dr(0), dr(1))) End While © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

3/27/2017 2:28 AM DB2DataAdapter Gestisce la sincronizzazione attraverso i 4 command object: SelectCommand UpdateCommand DeleteCommand InsertCommand Riempie un DataSet (metodo Fill) Aggiornamento dei dati in DB2 (metodo Update) © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Add-in per Visual Studio.NET 3/27/2017 2:28 AM Add-in per Visual Studio.NET IBM Explorer IBM Projects (DB2 Database Project) DB2 SQL Editor DB2 .Net Data Provider tools Dynamic Help for DB2 Add-Ins DB2 Tools menu Add-in © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

IBM Explorer: Data Connection 3/27/2017 2:28 AM IBM Explorer: Data Connection Simile al Server Explorer per visualizzare gli oggetti in DB2 Browsing dei dati Drag and drop degli oggetti e generazione del codice © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

SQL Editor Estensione dell’editor di VS.Net per editare script DDL 3/27/2017 2:28 AM SQL Editor Estensione dell’editor di VS.Net per editare script DDL Supporto per : Sintassi colorata per DB2 SQL Intellisense e code completion Gestione dei code fragments per il codice DML utilizzato più di frequente © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

3/27/2017 2:28 AM Tools Add-in Toolbar per lanciare gli strumenti DB2 da Visual Studio.NET 2003 Development Center Control Center Replication Center Command Center Task Center Health Center Journal © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Approfondimenti Download DB2 Personal Developer’s Edition (free) 3/27/2017 2:28 AM Approfondimenti Download DB2 Personal Developer’s Edition (free) Articoli e tutorial: IBM DB2 Development Add-Ins for Visual Studio .Net DB2 Database Project for Visual Studio .Net Creating a .NET Client that Uses DB2 DADX Web Services Creating and Linking LOBs in a Data Application for Microsoft .Net using DB2 Universal Database © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Risorse Siti web Newsgroup IBM DB2 Developer Domain 3/27/2017 2:28 AM Risorse Siti web IBM DB2 Developer Domain DB2 for Windows home su developerWorks DB2 .NET home page Newsgroup comp.databases.ibm-db2 news://news.software.ibm.com/ibm.software.db2.udb.beta news://news.software.ibm.com/ibm.software.db2.udb © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.