db2 development in .net environment - · pdf filedrag & drop support for webform and...

56
IBM Software Group ® DB2 Development in .NET Environment 김상협 부장 ([email protected]) DEVPIA Co., Ltd. .NET-consulting Div. Mgr.

Upload: docong

Post on 19-Feb-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

IBM Software Group

®

DB2 Development in .NET Environment

김상협부장 ([email protected])DEVPIA Co., Ltd..NET-consulting Div. Mgr.

IBM Software Group | DB2 Information Management Software

Agenda

• Introducing to .NET

• Setup Environment

• DB2 .NET Data Provider

• Visual Studio .NET Add-ins

• Stinger Beta Program in .NET

• Demo

• Reference

IBM Software Group | DB2 Information Management Software

Table of contents

Introducing to .NET

Setup Environment

DB2 .NET Data Provider

Visual Studio .NET Add-ins

Stinger Beta Program in .NET

Demo

Reference

IBM Software Group | DB2 Information Management Software

What is .NET?

.NET is a set of software technologies for connecting information, people, systems, and devices. It enables a high level of software integration through the use of Web services—small, discrete, building-block applications that connect to each other as well as to other, larger applications over the Internet.

IBM Software Group | DB2 Information Management Software

.NET Platform 구조

Common Language Runtime

Base Class Library

Data and XML

ASP.NET Windows Forms

Common Language Specification

VB C++ C#V

isual Studio.NE

TJ# …

Windows COM+ Services

IBM Software Group | DB2 Information Management Software

.NET Framework

Common Language Runtime

Base Class Library

Data and XML

ASP.NET

Common Language Specification

Windows Forms

IBM Software Group | DB2 Information Management Software

Common Language Runtime

.NET Framework Class Library Support.NET Framework Class Library Support

Thread SupportThread Support COM MarshalerCOM Marshaler

Type CheckerType Checker Exception ManagerException Manager

MSIL to NativeMSIL to NativeCompilersCompilers

CodeCodeManagerManager

GarbageGarbageCollectionCollection

Security EngineSecurity Engine DebuggerDebugger

Class LoaderClass Loader

IBM Software Group | DB2 Information Management Software

Base Class Library

System

System.Data System.Xml

System.Web

GlobalizationDiagnosticsConfigurationCollections

ResourcesReflectionNetIO

ThreadingTextServiceProcessSecurity

DesignADO

SQLTypesSQL

XPathXSLT

RuntimeInteropServicesRemotingSerialization

Serialization

Configuration SessionStateCaching Security

ServicesDescriptionDiscoveryProtocols

UIHtmlControlsWebControls

System.Drawing

ImagingDrawing2D

TextPrinting

System.WinFormsDesign ComponentModel

IBM Software Group | DB2 Information Management Software

Table of contents

Introducing to .NET

Setup Environment

DB2 .NET Data Provider

Visual Studio .NET Add-ins

Stinger Beta Program in .NET

Demo

Reference

IBM Software Group | DB2 Information Management Software

Preparations

OS(Windows 2000, xp pro, 2003)Internet Information Service, COM+, MSMQ, WMI

Visual Studio .NET(2003, Arch.)

DB2 UDB v8(AIX, HOST, Windows)

Fixpack6Visual Studio .NET Add-ins, DB2 .NET data provider

Stinger (Fixpack7) – Opt.

IBM Software Group | DB2 Information Management Software

DB2 UDB v8.16(Fixpack6) in .NET

DB2 .NET Data Provider support for Microsoft .NET framework V1.1and V1.0

Side-by-side support for Visual Studio .NET 2002 and 2003

Drag & drop support for WebForm and WinForm designers

Tooling support for DB2 for z/OS and 390 V7, V6, and DB2 for Linux, UNIX, and Windows V8.1

IBM Software Group | DB2 Information Management Software

Table of contents

Introducing to .NET

Setup Environment

DB2 .NET Data Provider

Visual Studio .NET Add-ins

Stinger Beta Program in .NET

Demo

Reference

IBM Software Group | DB2 Information Management Software

Logical Structure

IBM Software Group | DB2 Information Management Software

Disconnected Mode

DataSetDataSet

TableTable

TableTable

TableTable

TableTable

TableTable

Data AdapterData Adapter

Data AdapterData Adapter

Data AdapterData Adapter

DB2DB2

DB2DB2

OtherOther

SQLSQLServerServer

Data AdapterData Adapter

Data AdapterData Adapter

WinFormWinForm

WebFormWebForm

MobileMobileWebFormWebForm

System.DataSystem.Data IBM.Data.DB2IBM.Data.DB2

ETCETC((WindowsCEWindowsCE,,

ServieServie,,……))

IBM Software Group | DB2 Information Management Software

DB2 And Web Services

HTTPHTTPServerServer

WebWebContainerContainer WSWS

WSWS

WSWS

SOAP SOAP XMLXML

SOA

P SO

AP

XML

XML

SOASOAP P

XMLXML

SQLSQLSOAP SOAP XMLXML

SOAP SOAP XMLXML

BusinessBusinessLogicLogic

Container

BusinessBusinessLogicLogic

Container ContainerContainer

WSWS

WSWS

FnctnFnctn

WSWS

SPSP

HTML/XMLHTML/XML

HTTP(S)HTTP(S)

firewallfirewall

IBM Software Group | DB2 Information Management Software

Managed Providers - 1

Microsoft .NET FrameworkOleDb provider, Odbc provider

Microsoft Host Integration Server 2004Invoke CICS, IMS

Support Mainframe transaction processing

Visual Studio .NET IDE integration is not available

IBM DB2 UDB v8.1.2‘DB2 .NET data provider’

DB2 UDB for z/OS, OS/390 V7

IBM Software Group | DB2 Information Management Software

Managed Providers - 2

DataDirect Connect fo .NET, Edition 2.0‘DB2 Wire Protocol’DB2 UDB for z/OS, OS/390 v7.1, AS/400 V4R5, V5R1, V5R2Distributed transactions will not be supported.

Mono.Data.DB2Client‘IBM DB2 CLI API’Similar to the ODBC APICompiles on Windows and Linux

BorlandData Provider (BDP) for .NET that ships with Borland® C# Builder™Delphi™ 8 for the Microsoft® .NET Framework (abbreviated to "Delphi 8 for .NET")

IBM Software Group | DB2 Information Management Software

DB2 .NET data provider connection example

Simple Connection String"Database=TEST;UID=db2admin; PWD=password;");

DB2 .NET data provider(System.Data.Db2Client)DB2Connection cn = new DB2Connection( "Database=TEST;UserID=db2admin; Password=password;Server=IS500"); DB2Command cmd = new DB2Command("SELECT COUNT(*) FROM EMP01", cn); int count = Convert.ToInt32(cmd.ExecuteScalar());

IBM Software Group | DB2 Information Management Software

DB2 UDB Connection String

True - Enlistment to Distributed Transaction Coordinator (DTC) is allowed (this will only enlist if a COM+ transaction is in progress at connect time) - default

False - Enlistment to Distributed Transaction Coordinator (DTC) is not allowedEnlist

the amount of time (seconds) that the connection can remain idle in the connection pool, default is 15 seconds

Connection Lifetime

True - this particular connection will be put into the connection pool when it is closed

False - this particular connection will not be put into the connection pool when it is closed

Connection Reset

maximum pool size, default is no maximumMax Pool Size

minimum pool size, default is 0Min Pool Size

connection pooling switch (true/false, default is true)Pooling

Connection Timeout(seconds)Connect Timeout /

Timeout

server name with optional port number for direct connection (<server name/ipaddress>[:<port>])

Server

password*Password / PWD

user ID*User ID / UID

database alias (for cataloged database)*Database

descriptionkeyword

IBM Software Group | DB2 Information Management Software

Unmanaged Providers

OleDbAccessing through OleDb provider

iSeries Access V5R2 with ServicePack 2 over Odbc

Accessing through Odbc driver

iSeries

IBM Software Group | DB2 Information Management Software

Unmanaged Providers connection examples

OleDb provider(System.Data.OleDb)OleDbConnection cn = new OleDbConnection( "Provider=IBMDA400.1;Data Source=TEST;UserID=db2user;Password=db2user;Default Collection =SAMPLEDB");TCP/IP: "Provider=DB2OLEDB;Network Transport Library=TCPIP;Network Address=XXX.XXX.XXX.XXX;InitialCatalog=MyCtlg;Package Collection =MyPkgCol;DefaultSchema=Schema;User ID=MyUser;Password=MyPW“APPC: "Provider=DB2OLEDB;APPC Local LU Alias=MyAlias;APPCRemote LU Alias =MyRemote;Initial Catalog=MyCtlg;PackageCollection=MyPkgCol;DefaultSchema=Schema;UserID=MyUser;Password=MyPW"

Odbc driver(System.Data.Odbc)OdbcConnection cn = new OdbcConnection( "DSN=TestODBC; UID=db2user; PWD=db2user;DBQ=SAMPLEDB");

IBM Software Group | DB2 Information Management Software

Managed Code Example – connection pooling

IBM Software Group | DB2 Information Management Software

Table of contents

Introducing to .NET

Setup Environment

DB2 .NET Data Provider

Visual Studio .NET Add-ins

Stinger Beta Program in .NET

Demo

Reference

IBM Software Group | DB2 Information Management Software

지원되는 DB2 서버및시스템요구사항

Windows용 DB2 Universal Database, 버전 8.1

Microsoft Visual Studio .NET 2002, 2003z/OS 또는 OS/390용 DB2 Universal Database, 버전 7 및 8

Windows용 DB2 Universal Database, 버전 8.1

Microsoft Visual Studio .NET 2002, 2003Linux, UNIX 및 Windows용 DB2 Universal Database, 버전 8.1

클라이언트 시스템 요구사항지원되는 DB2 서버

IBM Software Group | DB2 Information Management Software

Unmanaged Providers

IBM ExplorerIBM Projects (DB2 Database Project)DB2 SQL EditorDB2 .NET Data Provider toolsDynamic Help for DB2 Add-InsDB2 Tools menu Add-in

IBM Software Group | DB2 Information Management Software

IBM ExplorerVisual Studio .NET Server Explorer와동일한형태로 DB2관련 objects만표시

database schema를불러와서database connections 생성허용Editor에드래그앤드롭으로소스코드를살펴볼수있다.Tables의내용불러볼수있다.

IBM Software Group | DB2 Information Management Software

IBM ExplorerData Connections

여러개의 database 연결을관리할수있다.Database의설정을변경하고관리할수있다.Database 의 schema 설정을변경하거나보여줄수있는범위를지정할수있다.여러 Application에서제공되는 designer에드래그앤드롭으로 database component를생성하고코드를자동으로생성해준다.

IBM Software Group | DB2 Information Management Software

New Project TypeThe DB2 Database Project

Visual Studio .NET named DB2 Database Project folder• 다중설정지원

• Procedures, Functions, and generic scripts folders

• Scripts build order dialogue• Visual Source Safe를통한 Source

control 관리, 프로젝트협업가능

IBM Software Group | DB2 Information Management Software

New Project TypeSQL Procedures script folder

DB2 SQL SP에관련된 DDL 작성

DB2 SQL Procedure wizard를통해손쉽게procedure 작성가능

SQL Functions script folder

DB2 SQL UDF에관련된 DDL 작성

DB2 SQL User Defined Function wizard로손쉽게 table, scalar functions script 작성가능

IBM Software Group | DB2 Information Management Software

New Project Type

일반적인 script foldertriggers, tables, views 등의 DB2 DDL/DML 포함

IBM Software Group | DB2 Information Management Software

SQL EditorVisual Studio .NET editor와통합된환경으로동일기능지원The DB2 SQL Editor에서지원되는기능

DB2 SQL syntax highlighting (colorized SQL)

DB2 SQL statement completion via Visual Studio .NET IntelliSense• Object names• Column names• Parameters

IBM Software Group | DB2 Information Management Software

Tools Add-InToolbar나도구메뉴에 DB2 Centers 포함

Development Center

Control Center

Replication Center

Command Center

Task Center

Health Center

Journal

IBM Software Group | DB2 Information Management Software

DB2 Data Provider ToolsIBM Explorer에서드래그앤드롭으로추가

DB2 Data Adapter Wizard 설정•DB2 connection과 command text 2단계설정

연결문자열을위한 Custom editor

실행명령문을위한 Custom editor

IBM Software Group | DB2 Information Management Software

HelpIBM Help – DB2 Database Project and DB2 Data

ConnectionsVisual Studio .NET help 기능에포함검색, 목차등다양한도움제공동적도움말지원

IBM Software Group | DB2 Information Management Software

Table of contents

Introducing to .NET

Setup Environment

DB2 .NET Data Provider

Visual Studio .NET Add-ins

Stinger Beta Program in .NET

Demo

Reference

IBM Software Group | DB2 Information Management Software

Stinger – the next release of DB2 UDB

Stinger is the next release of DB2 UDB, and it's chock full of new features that cut the time-to-value for your on demand solutions.

It will feature enhancements for application development, vast improvements in lights-out operation and manageability, high availability, security, and a whole lot more.

the nickname for the preview of the next release of DB2 UDB for Linux, UNIX®, and Windows®. -> Fixpack7(v8.1.7)

IBM Software Group | DB2 Information Management Software

New Features in VS.NET

DB2 Class Library Project

CLR Procedure Wizard

-Business Logic Layer-DB2 Class Template(reference assembly, using DB2 .NET provider)

.NET-based stored procedure

IBM Software Group | DB2 Information Management Software

CLR Stored Procedure

Build DB2 server side logic in any .NET programming language (e.g., C#, Visual Basic .NET)

DB2 server-side logic executes as managed code

Server side logic can include SQL, OS, .NET and other calls

Use DB2 add-ins for Visual Studio .NET to build, test, debug, and deploy

IBM Software Group | DB2 Information Management Software

DB2 Class Library Template Example

IBM Software Group | DB2 Information Management Software

Supported Platform

AIX, LINUX, WINDOWS

DB2 "Stinger" Beta: AIX server and documentation DB2 Information Center (online documentation) for Windows (32-bit)DB2 Enterprise Server for Windows (32-bit)DB2 Express Server for Windows (32-bit)DB2 Spatial Extender for Windows (32-bit)DB2 Runtime Clients and Merge Modules for Windows (32-bit) in a variety of languagesDB2 Connect Personal Edition for Windows (32-bit)DB2 Embedded Application Server for Windows (32-bit)DB2 Mobility on Demand for Windows (32-bit_: includes clients for embedded devicesDB2 Administration Client Windows (32-bit)DB2 Application Development Client for Windows (32-bit)

IBM Software Group | DB2 Information Management Software

Table of contents

Introducing to .NET

Setup Environment

DB2 .NET Data Provider

Visual Studio .NET Add-ins

Stinger Beta Program in .NET

Demo

Reference

IBM Software Group | DB2 Information Management Software

DEMO Scenario

DB2DataAccess Class Library – DB2 Server Access AgentXML Web Service – DB2 Data Web Service ProviderASP.NET Web Application– Web Service ConsumerWindows Application – Web Service Client 1Mobile Web Application – Web Service Client 2

IBM Software Group | DB2 Information Management Software

DEMO Scenario Diagram

DB2 Server Access Agent

DB2 Data Web Service Provider

Web Service ConsumerWindowsWeb Service Client 1

MobileWeb Service Client 2 Web Browser Client

DB2 Server

IBM Software Group | DB2 Information Management Software

Demo

IBM Software Group | DB2 Information Management Software

Demo

IBM Software Group | DB2 Information Management Software

Demo

IBM Software Group | DB2 Information Management Software

Demo

IBM Software Group | DB2 Information Management Software

Demo

IBM Software Group | DB2 Information Management Software

Table of contents

Introducing to .NET

Setup Environment

DB2 .NET Data Provider

Visual Studio .NET Add-ins

Stinger Beta Program in .NET

Demo

Reference

IBM Software Group | DB2 Information Management Software

DB2 .NET Data Provider Samples

TbUse.vbTbUse.csHow to manipulate table data with the DB2 .Net Data Provider

TbTrig.vbTbTrig.csHow to use triggers on a table with the DB2 .Net Data Provider

TbPriv.vbTbPriv.csHow to grant, display and revoke privileges on a table

TbInfo.vbTbInfo.csHow to get information about a table

TbConstr.vbTbConstr.csHow to create, use and drop table constraints

SpReturn.vbSpReturn.csHow to call a stored procedure that has a return value

SpClient.vbSpClient.csCall different types of stored procedures from SpServer.java

DtLob.vbDtLob.csHow to use the LOB data type with the DB2 .Net Data Provider

DbValue.vbDbValue.csHow to obtain a single value from a database

DbUse.vbDbUse.csHow to use a database with the DB2 .Net Data Provider

DbEvent.vbDbEvent.csHow to use DB2DataAdapter events: RowUpdating and RowUpdated

DbDsetCn.vbDbDsetCn.csHow to add existing constraints to a DataSet

DbDatMap.vbDbDatMap.csHow to set up and use DataTable and DataColumn mappings

DbDatAdp.vbDbDatAdp.csHow to use a DB2DataAdapter with the DB2 .NET Data Provider

DbAuth.vbDbAuth.sHow to grant, display and revoke privileges on database

Visual Basic SampleC# SampleSample Description

* ms-help://MS.VSCC.2003/IBM.Data.2003.1033/DB2DNPref/htm/frlrfIBMdataDB2DB2samples.htm

IBM Software Group | DB2 Information Management Software

Reference – Stinger Beta Program

Stinger Beta Downloadhttps://www6.software.ibm.com/dl/dm/dm-adtp-p

Stinger Newsgroupnews://news.software.ibm.com/ibm.software.db2.udb.beta

IBM Software Group | DB2 Information Management Software

Reference – Examples

Creating and Linking LOBs in a Data Application for Microsoft .NET using DB2 Universal Database

http://www-106.ibm.com/developerworks/db2/library/techarticle/0304surange/0304surange.html

IBM DB2 Development Add-Ins for Visual Studio .NEThttp://www-106.ibm.com/developerworks/db2/library/techarticle/0304alazzawe/0304alazzawe.html

DB2 Database Project for Visual Studio .NEThttp://www-106.ibm.com/developerworks/db2/library/techarticle/0304alazzawe1/0304alazzawe1.html

IBM Software Group | DB2 Information Management Software

Reference – Examples

DB2 Development Add-In Technical Previewhttp://www-106.ibm.com/developerworks/db2/library/techarticle/0311alazzawe/0311alazzawe.html

Developing DB2 CLR Procedures in VS.NEThttp://www-106.ibm.com/developerworks/db2/library/tutorials/0311alazzawe1/index.html

Developing DB2 schema using IBM Explorer in VS.NEThttp://www-106.ibm.com/developerworks/db2/library/tutorials/0311alazzawe2/index.html

Developing Re-usable Data Adapters in VS.NEThttp://www-106.ibm.com/developerworks/db2/library/tutorials/0311alazzawe3/index.html

Developing DB2 UDB Database Projects in VS.NEThttp://www-106.ibm.com/developerworks/db2/library/tutorials/0305alazzawe/

IBM Software Group | DB2 Information Management Software

Reference – .NET

DB2 and .NET Frameworkhttp://www-106.ibm.com/developerworks/db2/downloads/dotnetbeta/

Latest DB2 FixPaks and clients(v8.1.5)http://www-306.ibm.com/cgi-bin/db2www/data/db2/udb/winos2unix/support/download.d2w/report

IBM Software Group | DB2 Information Management Software

Reference – C# Sample Source

C# Samplehttp://publib.boulder.ibm.com/infocenter/db2help/index.jsp?topic=/com.ibm.db2.udb.doc/ad/r0011079.htm

IBM Software Group | DB2 Information Management Software

Q & A