没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
Oracle® Database
2 Day + .NET Developer’s Guide
11g Release 2 (11.2)
E10767-01
August 2009
Oracle Database 2 Day + .NET Developer's Guide, 11g Release 2 (11.2)
E10767-01
Copyright © 2006, 2009, Oracle and/or its affiliates. All rights reserved.
Primary Authors: Janis Greenberg, Roza Leyderman
Contributing Authors: John Paul Cook, Mark Williams
Contributors: Alex Keh, Christian Shay
This software and related documentation are provided under a license agreement containing restrictions on
use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your
license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,
transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse
engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is
prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If
you find any errors, please report them to us in writing.
If this software or related documentation is delivered to the U.S. Government or anyone licensing it on
behalf of the U.S. Government, the following notice is applicable:
U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data
delivered to U.S. Government customers are "commercial computer software" or "commercial technical data"
pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As
such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and
license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of
the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software
License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065.
This software is developed for general use in a variety of information management applications. It is not
developed or intended for use in any inherently dangerous applications, including applications which may
create a risk of personal injury. If you use this software in dangerous applications, then you shall be
responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use
of this software. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of
this software in dangerous applications.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks
of their respective owners.
This software and documentation may provide access to or information on content, products, and services
from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all
warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and
its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of
third-party content, products, or services.
iii
Contents
Preface ................................................................................................................................................................ vii
Audience...................................................................................................................................................... vii
Documentation Accessibility.................................................................................................................... vii
Related Documents ................................................................................................................................... viii
Conventions ............................................................................................................................................... viii
1 Introduction
About This Guide..................................................................................................................................... 1-1
What is the Microsoft .NET Framework .............................................................................................. 1-2
Overview of Oracle Data Provider for .NET....................................................................................... 1-2
Overview of Oracle Developer Tools for Visual Studio .................................................................. 1-2
Overview of .NET Stored Procedures .................................................................................................. 1-2
Overview of Oracle Providers for ASP.NET....................................................................................... 1-3
2 Installing .NET Products
What You Need......................................................................................................................................... 2-1
Oracle Database.................................................................................................................................. 2-1
Sample Data ........................................................................................................................................ 2-1
Oracle Data Access Components..................................................................................................... 2-2
Oracle Database Extensions for .NET ............................................................................................. 2-2
Visual Studio Versions ..................................................................................................................... 2-2
Installing .NET Products......................................................................................................................... 2-2
Configuring a NET Connect Alias ........................................................................................................ 2-7
Setup for Oracle Providers for ASP.NET............................................................................................. 2-8
Oracle Providers for ASP.NET Database User Setup ................................................................... 2-9
Creating the User and Granting Privileges............................................................................. 2-9
Configuring All Oracle Providers for ASP.NET ................................................................. 2-12
Configuring Oracle Providers for ASP.NET Individually................................................. 2-15
Uninstalling Schemas for Oracle Providers for ASP.NET ................................................ 2-16
Setting the Connection String........................................................................................................ 2-16
Customizing Oracle Providers for ASP.NET for Different Setups .......................................... 2-16
3 Building a Simple .NET Application Using ODP.NET
Creating a New Project............................................................................................................................ 3-1
Adding a Reference.................................................................................................................................. 3-4
iv
Adding Namespace Directives .............................................................................................................. 3-5
Designing the User Interface ................................................................................................................. 3-7
Writing the Connection Code ............................................................................................................. 3-10
Compiling and Running the Application ........................................................................................ 3-13
Error Handling....................................................................................................................................... 3-14
Using Try-Catch-Finally Block Structure .................................................................................... 3-15
Handling General Errors................................................................................................................ 3-15
Handling Common Oracle Errors ................................................................................................ 3-16
4 Retrieving and Updating with Oracle Data Provider for .NET
Using the Command Object................................................................................................................... 4-1
Retrieving Data: a Simple Query .......................................................................................................... 4-2
Retrieving Data: Bind Variables ........................................................................................................... 4-4
Retrieving Data: Multiple Values ......................................................................................................... 4-6
Using the DataSet Class with Oracle Data Provider for .NET ........................................................ 4-8
Enabling Updates to the Database..................................................................................................... 4-10
Inserting, Deleting, and Updating Data ........................................................................................... 4-12
5 Using Oracle Developer Tools for Visual Studio
Using Oracle Developer Tools............................................................................................................... 5-1
Connecting to the Oracle Database....................................................................................................... 5-1
Creating a Table and Its Columns ........................................................................................................ 5-5
Creating a Table Index ............................................................................................................................ 5-8
Adding Table Constraints ................................................................................................................... 5-10
Adding Data to a Table ........................................................................................................................ 5-13
Generating Code Automatically to Display and Update Data..................................................... 5-14
6 Using PL/SQL Stored Procedures and REF CURSORs
Introduction to PL/SQL Stored Procedures......................................................................................... 6-1
Introduction to PL/SQL Packages and Package Bodies .................................................................... 6-1
Introduction to REF CURSORs ............................................................................................................. 6-2
Creating a PL/SQL Stored Procedure that Uses REF CURSORs..................................................... 6-2
Modifying an ODP.NET Application to Run Stored Procedures................................................... 6-8
Running a PL/SQL Stored Procedure Using an ODP.NET Application ....................................... 6-9
7 Using ASP.NET with Oracle Database
Overview: Building an ASP.NET Application with Oracle Developer Tools ............................. 7-1
Before Beginning This Tutorial............................................................................................................. 7-1
Creating a Web Site and Connecting it to the Database................................................................... 7-2
Creating an ASP.NET Web Site........................................................................................................ 7-2
Creating a Data Source...................................................................................................................... 7-5
Enabling a Web Site for Authentication........................................................................................... 7-11
Enabling Oracle Providers for ASP.NET and Creating a Lightweight Web User.................... 7-13
Testing Web Site Authentication ....................................................................................................... 7-20
v
8 Developing and Deploying .NET Stored Procedures
Overview of .NET Stored Procedures .................................................................................................. 8-1
Starting the Common Language Runtime Service ............................................................................ 8-1
Creating a Connection as SYSDBA....................................................................................................... 8-2
Creating an Oracle Project ...................................................................................................................... 8-4
Creating .NET Stored Functions and Procedures............................................................................... 8-5
Deploying .NET Stored Functions and Procedures........................................................................... 8-7
Running .NET Stored Functions and Procedures ........................................................................... 8-12
Running .NET Stored Procedure in a Query Window................................................................... 8-13
9 Including Globalization Support
Introduction to Global Applications .................................................................................................... 9-1
Developing Global Applications with the .NET Framework.......................................................... 9-1
Presenting Data in the Correct User Local Convention .................................................................... 9-2
Connecting to SQL*Plus ................................................................................................................... 9-2
Using Oracle Date Formats............................................................................................................... 9-2
Using Oracle Number Formats........................................................................................................ 9-4
Using Oracle Linguistic Sorts........................................................................................................... 9-5
Oracle Error Messages....................................................................................................................... 9-6
Synchronizing the .NET and Oracle Database Locale Environments ........................................... 9-7
Client Globalization Support in Oracle Data Provider for .NET ................................................... 9-8
Client Globalization Settings............................................................................................................ 9-8
Using Session Globalization Settings.............................................................................................. 9-9
Thread-Based Globalization Settings........................................................................................... 9-13
A Starting and Stopping an Oracle Database Instance
B Copying a Form
Index
剩余153页未读,继续阅读
资源评论
weixin_40191861_zj
- 粉丝: 62
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功