PL/SQL Programming for.net Developers: Tips, Tricks, and Debugging

Similar documents
SQL and PL/SQL Development and Leveraging Oracle Multitenant in Visual Studio. Christian Shay Product Manager, NET Technologies Oracle

New 11g Features in Oracle Developer Tools for Visual Studio. An Oracle White Paper January 2008

Copyright 2014, Oracle and/or its affiliates. All rights reserved.

Track and Keynote/Session Title 9:00:00 AM Keynote 11g Database Development Java Track Database Apex Track.Net Track. 09:30:00 AM with Oracle and

What s New with Oracle Database 12c on Windows On-Premises and in the Cloud

<Insert Picture Here> Oracle SQL Developer 3.0: Overview and New Features

Top 10 Oracle SQL Developer Tips and Tricks

<Insert Picture Here> Oracle on Windows and.net

Oracle Database: Program with PL/SQL

Using SQL Developer. Copyright 2008, Oracle. All rights reserved.

Oracle Database 10g Release 2 on Windows: Development and Deployment. An Oracle Technical White Paper May 2006

Developing SQL and PL/SQL with JDeveloper

Oracle SQL Developer for Database Developers. An Oracle White Paper June 2007

Oracle Database: Program with PL/SQL

To install Multifront you need to have familiarity with Internet Information Services (IIS), Microsoft.NET Framework and SQL Server 2008.

Oracle Database: Program with PL/SQL

Oracle Database: Program with PL/SQL

Oracle 11g PL/SQL training

Creating PL/SQL Blocks. Copyright 2007, Oracle. All rights reserved.

Application Development With Data Studio

Oracle Database: SQL and PL/SQL Fundamentals

Visual Basic. murach's TRAINING & REFERENCE

Oracle Database: Program with PL/SQL

Oracle SQL Developer for Database Developers. An Oracle White Paper September 2008

Duration Vendor Audience 5 Days Oracle Developers, Technical Consultants, Database Administrators and System Analysts

Oracle Database: SQL and PL/SQL Fundamentals NEW

Setting up the Oracle Warehouse Builder Project. Topics. Overview. Purpose

DEPLOYING A VISUAL BASIC.NET APPLICATION

Setting up SQL Translation Framework OBE for Database 12cR1

New Features in Oracle Application Express 4.1. Oracle Application Express Websheets. Oracle Database Cloud Service

Getting Started with Telerik Data Access. Contents

How to test and debug an ASP.NET application

Oracle Tools and Bindings with languages

Mixed Authentication Setup

How To Create An Easybelle History Database On A Microsoft Powerbook (Windows)

How To - Implement Single Sign On Authentication with Active Directory

SelectSurvey.NET Developers Manual

Crystal Reports. For Visual Studio.NET. Reporting Off ADO.NET Datasets

Millennium Drive. Installation Guide

FileMaker 11. ODBC and JDBC Guide

Oracle Database 11g: Program with PL/SQL

Microsoft Active Directory and Windows Security Integration with Oracle Database

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

ibolt V3.2 Release Notes

Print Audit 6 Network Installation Guide

Using the Query Analyzer

Application Development

ResPAK Internet Module

SQL Server An Overview

MS Enterprise Library 5.0 (Logging Application Block)

linux20 (R12 Server) R Single Node SID - TEST linux1 (10gAS Server) Oracle 10gAS ( ) with OID SID - asinf server name

FileMaker 12. ODBC and JDBC Guide

Net Developer Role Description Responsibilities Qualifications

PL/SQL Developer 7.1 User s Guide. March 2007

SQL Server for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach

SharePoint Integration Framework Developers Cookbook

Building Java Servlets with Oracle JDeveloper

ORACLE 9I / 10G / 11G / PL/SQL COURSE CONTENT

Oracle Database: SQL and PL/SQL Fundamentals NEW

Debugging Export Connectors With Visual Studio.NET

VB.NET - WEB PROGRAMMING

How To Use Query Console

FileMaker 13. ODBC and JDBC Guide

Developing and Deploying SQL Server Applications on HP Integrity Servers

Print Audit 6 - SQL Server 2005 Express Edition

StreamServe Persuasion SP4

RFID Tracking System Installation

Aradial Installation Guide

Maximizing Performance for Oracle Database 12c using Oracle Enterprise Manager

DEVELOPING CONTRACT - DRIVEN WEB SERVICES USING JDEVELOPER. The purpose of this tutorial is to develop a java web service using a top-down approach.

QUANTIFY INSTALLATION GUIDE

2933A: Developing Business Process and Integration Solutions Using Microsoft BizTalk Server 2006

Oracle Database: SQL and PL/SQL Fundamentals

Agile Business Suite: a 4GL environment for.net developers DEVELOPMENT, MAINTENANCE AND DEPLOYMENT OF LARGE, COMPLEX BACK-OFFICE APPLICATIONS

6.2 Reporting BIPublisher Improvements

Tips and Tricks for Using Oracle TimesTen In-Memory Database in the Application Tier

Oracle Database: Develop PL/SQL Program Units

ProjectWise Mobile Access Server, Product Preview v1.1

Video Administration Backup and Restore Procedures

Download and Installation of MS SQL Server

MyOra 3.5. User Guide. SQL Tool for Oracle. Kris Murthy

Rapid SQL 7.6 Evaluation Guide. Published: January 12, 2009

Microsoft Business Intelligence 2012 Single Server Install Guide

Migrating Non-Oracle Databases and their Applications to Oracle Database 12c O R A C L E W H I T E P A P E R D E C E M B E R

BUILDER 3.0 Installation Guide with Microsoft SQL Server 2005 Express Edition January 2008

Secure Messaging Server Console... 2

Wakanda Studio Features

<Insert Picture Here> Move to Oracle Database with Oracle SQL Developer Migrations

Oracle8/ SQLJ Programming

Oracle Database 11g: Advanced PL/SQL

How To Set Up Safetica Insight 9 (Safetica) For A Safetrica Management Service (Sms) For An Ipad Or Ipad (Smb) (Sbc) (For A Safetaica) (

Developing Database Business Applications using VB.NET

NSi Mobile Installation Guide. Version 6.2

An Oracle White Paper May Creating Custom PDF Reports with Oracle Application Express and the APEX Listener

Transcription:

PL/SQL Programming for.net Developers: Tips, Tricks, and Debugging Christian Shay Product Manager,.NET Technologies Oracle

Oracle.NET Customer Advisory Board Focus group that provides Oracle input and help to prioritize new features Led by Oracle VP Work directly with Oracle Development and PM Best for organizations in which Oracle.NET is strategic Contact me for details and how to apply

Program Agenda 1 2 3 4 SQL and PL/SQL Development Lifecycle in Visual Studio Using PL/SQL with ODP.NET PL/SQL Debugging Next Steps

SQL and PL/SQL Development Lifecycle in Visual Studio

Oracle s.net Products Oracle Developer Tools for Visual Studio Tightly integrated Add-in for Visual Studio 2013, 2012, 2010 Oracle Data Provider for.net (ODP.NET) ADO.NET compliant data provider Utilize advanced Oracle Database features RAC, performance, security, data types, XML, etc. Both available for free download: http://otn.oracle.com/dotnet/

SQL and PL/SQL Development Lifecycle Create Database, Schema Objects, PL/SQL procedures, functions, packages Run SQL*Plus Scripts with existing scripts Oracle Wizards and designers Query Window Ad Hoc SQL Import Table Wizard Oracle Multitenant Use VS to Clone and Plug in existing PDB or create new one

SQL and PL/SQL Development Lifecycle Create SQL and PL/SQL scripts Generate Create Script from existing schema objects Use Schema Compare tool to generate diff script Store scripts in source control Oracle Database Project Edit SQL and PL/SQL Scripts Oracle SQL Editor file based Oracle PL/SQL Editor database based

SQL and PL/SQL Development Lifecycle Tune SQL Oracle Performance Analyzer SQL Tuning Advisor Create client side.net code (C#, VB.NET, ASP.NET) Use Oracle Data Provider for.net to call PL/SQL Debug.NET and PL/SQL together PL/SQL Debugger in Visual Studio

SQL and PL/SQL Development Lifecycle Deploy New deployments Run SQL scripts to create schema objects Clone and plug in PDBs Updating existing deployments Create and run diff script using output scripts from Schema Compare tool

D E M O N S T R A T I O N SQL and PL/SQL Lifecycle in VS

Using PL/SQL with ODP.NET

Introduction Any PL/SQL Call is Supported Stored Procedure Stored Function Package Method Anonymous block Batch SQL support

PL/SQL Data Types Available in.net Data Types PL/SQL Types REF Cursor Associative Array (formerly index-by table) User Defined Types ODP.NET Types vs..net types OracleParameter.DbType OracleParameter.OracleDbType

Batching SQL and deferring fetching You want to execute SQL queries in Stored Procedures and then fetch as needed from the client You want to batch SQL multiple SQL statements in one PL/SQL anonymous block Solution: Use REF CURSORS and Anonymous PL/SQL

REF Cursors Characteristics Pointer to result set on server side Read only Forward only Advantages Input REF Cursor parameters Retrieve multiple REF Cursors in a single round trip

D E M O N S T R A T I O N REF CURSORS

Passing large amounts of data You want to pass in or retrieve large amounts of data in one round trip with best performance possible You are using scalar types Solution: Use associative arrays

Associative Arrays Characteristics Must declare size of array Index key must be sequential Index key must be non-negative integers Advantages Pass large amount of data between the DB and.net in one array Reduces number of parameters Reduces round trips, easier batch processing

Using Associative Arrays in.net Steps to bind an associative array parameter Set OracleParameter.CollectionType to OracleCollectionType.PLSQLAssociativeArray Set OracleParameter.ArrayBindSize for *each* array element Only necessary for variable-length data types Set OracleParameter.Size for number of array elements

D E M O N S T R A T I O N Associative Arrays

Anonymous PL/SQL Executes multiple SQL statements in a single batch Saves DB round trips Execute as CommandType.Text Generate dynamically based on application requirements string cmdtxt = "BEGIN " + "OPEN :1 for select * from emp where deptno = 10; " + "OPEN :2 for select * from dept where deptno = 20; " + "INSERT INTO DEPT VALUES (50, IT', SAN FRANCISCO');" + "END;";

D E M O N S T R A T I O N Anonymous PL/SQL

Using Pre-Defined PL/SQL Packages DB server provides PL/SQL packages to all of Oracle s key functionality Can be used from ODP.NET, similar to any other PL/SQL call Sample pre-packaged functionality DBMS_AQ DBMS_OLAP DBMS_STREAMS SDO_GEOM

UDTs, VARRAYs and NESTED TABLES Use ODT Custom Class Code Generation wizard Oracle by Example walkthrough of Code Generation Wizard: http://goo.gl/w3owp6 Bind the generated classes to input and output parameters See this ODP.NET doc section for binding information: Oracle User-Defined Types (UDTs) and.net Custom Types If installed, check out code samples in directory <Oracle_Home>\odp.net\samples\4.x\UDT

UDTs, VARRAYs and NESTED TABLES Code Example MyVarrayCustomClass pa = new MyVarrayCustomClass(); pa.array = new Int32[] { 1, 2, 3, 4 }; pa.statusarray = new OracleUdtStatus[] { OracleUdtStatus.NotNull. param.oracledbtype = OracleDbType.Array; param.direction = ParameterDirection.Input; param.udttypename = MYVARRAY"; param.value = pa;

PL/SQL Debugging

Oracle PL/SQL Debugging Architecture Oracle Developer Tools for Visual Studio Visual Studio Environment VS sends requests to Oracle over TCP/IP connection: Step Into Please What are the local variable values? Set Breakpoint here Connect user/pass When connect to Oracle we pass: ORA_DEBUG_JDWP= host=hostname;port=portnum Oracle 10.2 or later PL/SQL Debugging Engine Does all the work of debugging

PL/SQL Debugging Configuration Can be tricky the first time since so many steps Check out the PL/SQL Debugging Chapter in ODT online doc Debugging Setup Checklist Work through the Oracle by Example demo: http://goo.gl/sxvz8w

D E M O N S T R A T I O N PL/SQL Debugging Doc

PL/SQL Debugging Configuration GRANT debug privileges as SYSDBA GRANT DEBUG ANY PROCEDURE TO username GRANT DEBUG CONNECT SESSION TO username Set port range and IP in Debugging Options page Tools -> Options->Oracle Developer Tools Compile PL/SQL units for Debug Via menu in PL/SQL editor or in Server Explorer Server Explorer Icons change color to remind you to recompile later

PL/SQL Debugging Configuration New requirement in Oracle Database 12c: SYSDBA must grant ACL access on IP Address Port Range Schema name Use new Grant Debugging Privileges dialog Right click on Schema name to be granted both debugging roles and the ACL privileges

PL/SQL Debugging Configuration Or issue this PL/SQL as SYSDBA: BEGIN DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE( HOST => 127.0.0.1', LOWER_PORT => 65000, UPPER_PORT => 65300, ACE => XS$ACE_TYPE(PRIVILEGE_LIST => XS$NAME_LIST('jdwp'), PRINCIPAL_NAME => 'HR', PRINCIPAL_TYPE => XS_ACL.PTYPE_DB)); END;

Direct Database Debugging Debug directly inside the database, no application code Step Into from Server Explorer Run Debug from Server Explorer Enter parameters manually Not useful with array parameters or complex types

Application Debugging Mode Step from.net code into PL/SQL and back from one instance of Visual Studio Useful for client server code (not web apps) Check off Tools -> Oracle Application Debugging ODT automatically starts listener using port in range given in Options page Uncheck "Enable the Visual Studio hosting process" in the.net Project Properties Debug tab

D E M O N S T R A T I O N Direct and App Debugging

External Application Debugging Dedicated VS instance for debugging PL/SQL only Use additional VS instance for any.net code (eg ASP.NET app) PL/SQL called by 10.2 client or later running on ANY platform Set ORA_DEBUG_JDWP in client environment SET ORA_DEBUG_JDWP=host=mymachine;port=4444 Set in web app environment BEFORE connecting Start Listener Tools-> Start Oracle External Application Debugger

D E M O N S T R A T I O N External PL/SQL Debugging

Using DBMS_DEBUG_JDWP Package Allows you to pick and choose when debugging is turned on Good solution when PL/SQL packaged procedure is called often but you only are interested in debugging specific cases Enable External Application Debugging Provide port number and IP address

Using DBMS_DEBUG_JDWP Package Add calls to these PL/SQL Procedures to your SP: DBMS_DEBUG_JDWP.CONNECT_TCP(HOST VARCHAR2, PORT VARCHAR2) DBMS_DEBUG_JDWP.DISCONNECT Compile Debug Set Breakpoint Enable External Application Debugging Call SP from external application or middle tier

Next Steps

Oracle.NET Customer Advisory Board Focus group that provides Oracle input and help to prioritize new features Led by Oracle VP Work directly with Oracle Development and PM Best for organizations in which Oracle.NET is strategic Contact me for details and how to apply

Additional Oracle.NET Resources OTN otn.oracle.com/dotnet Twitter twitter.com/oracledotnet YouTube youtube.com/oracledotnetteam Email christian.shay@oracle.com

Safe Harbor Statement The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle s products remains at the sole discretion of Oracle.