Transcript Document

IDS and .NET
Rajesh Nair & Chris Golledge
Kansas City, MO
January 30, 2004
IBM Corporation 2003
Agenda
•
•
•
•
•
Overview of .NET
.NET Framework Architecture
ADO.NET Architecture
Features of the IDS .NET Provider
Roadmap of IDS .NET Support
IBM Corporation 2003
Kansas City Informix User's Group
Overview of .NET
• .NET is a new framework for developing
enterprise applications
– Actively in use on Microsoft Windows platforms
– No single language required for development
• .NET is a response to industry trends:
–
–
–
–
–
Distributed Computing
Componentization
Enterprise Services
Web paradigm shifts
Maturity
IBM Corporation 2003
Kansas City Informix User's Group
Overview of .NET
• Requires a new API (provider) for access to
data sources
– API is exposed as a set of .NET interfaces
• Object-Oriented Architecture
• “Namespaces” used to organize classes into
related groups
• Managed vs. Unmanaged code
IBM Corporation 2003
Kansas City Informix User's Group
.NET Framework Architecture
Web Services
ASP.NET
Win Forms
V
S.
ADO.NET / XML Classes
N
Framework Base Classes
E
CLR
T
IBM Corporation 2003
Kansas City Informix User's Group
.NET Framework Architecture
IBM Corporation 2003
Kansas City Informix User's Group
.NET Framework Architecture
• Common Language Runtime (CLR)
– runtime environment that manages memory, garbage
collection, code access security
– managed code
• Framework Base Classes
– provide I/O, collections, and threading functionality
• ADO.NET
– provides data access API
• ASP.NET, Web Services & Forms
– focuses on specific aspects of application development
IBM Corporation 2003
Kansas City Informix User's Group
ADO .NET Architecture
• .NET framework’s data management
capabilities are encapsulated into a single
component : ADO.NET
• ADO.NET contains:
– Data Provider API which interacts with the
actual data source
– Content class, DataSet, which provides
application program level abstraction for the
data to/from the data source
IBM Corporation 2003
Kansas City Informix User's Group
What is a .NET Provider?
• Runtime class library that encapsulates a
data access API for use by Microsoft .NET
applications
• Set of specialized classes that
implement standard ADO.NET
interfaces and serve as a bridge
between a data source and .NET
applications
IBM Corporation 2003
Kansas City Informix User's Group
ADO .NET Architecture
Client
Application
DataSet
DataRelation
DataTable
DataColumn
DataColumn
DataColumn
DataColumn
.NET Provider Classes
DataReader
DataAdapter
Command
Transaction
Connection
IBM Corporation 2003
Kansas City Informix User's Group
ADO .NET Architecture
• System.Data namespace – Microsoft class library
for general data access functionality
• Default “bridge” providers for use with
System.Data class and either an OLEDB provider
or an ODBC driver
– Provide IDS connectivity via Informix OLEDB or
ODBC driver
• IBM.Data.Informix – Informix namespace which
defines a class library implementing .NET
interfaces for IBM Informix data access
IBM Corporation 2003
Kansas City Informix User's Group
ADO .NET Data Retrieval
• Two Models
– Connected
• similar to typical client/server model
• obtains and maintains a connection with which to work
– Disconnected
• by default, data is disconnected in .NET
• DataSet supports this model by presenting an in-memory view
of a data source
• after data is retrieved, connection can be discarded
• changes performed on DataSet can be applied to the database
with a new connection
IBM Corporation 2003
Kansas City Informix User's Group
Classes defined by the IDS .NET
Provider
• IfxConnection – manages a connection to an Informix
database
• IfxTransaction – represents a database transaction
• IfxCommand – manages execution of SQL commands
• IfxCommandBuilder – automatically generates
commands, given a SELECT statement
• IfxParameter – represents a parameter to a Command
object
• IfxParameterCollection – represents a collection of all
parameters relevant to a Command object
IBM Corporation 2003
Kansas City Informix User's Group
Classes defined by the IDS .NET
Provider
• IfxDataReader – provides forward-only, read-only
access to data
• IfxDataAdapter
– boundary between .NET provider and non-provider
content classes
– builds the DataSet objects (DataTable, DataColumn,
DataRow etc), given a query and a DataSet instance
• IfxError, IfxException, IfxErrorCollection - for
error and exception processing
IBM Corporation 2003
Kansas City Informix User's Group
IfxConnection Details
• Can be established:
– programmatically using ConnectionString
property of IfxConnection class
– user environment
– using SetNet to update the system registry
database
• Order of precedence is ConnectionString,
user environment, and then SetNet
IBM Corporation 2003
Kansas City Informix User's Group
Connection Attributes
•
•
•
•
•
•
•
•
User and Password
INFORMIXSERVER
Database Name
Service
CLIENT_LOCALE
DB_LOCALE
Fetch Buffer Size
Enlist (in a distributed
transaction)
•
•
•
•
•
•
Connection Pooling
Connection Time Out
Connection Lifetime
Minimum Pool Size
Maximum Pool Size
Persist Security Info
IBM Corporation 2003
Kansas City Informix User's Group
Data Types in the IDS .Net Provider
Informix Database Type
.Net Framework Type
.Net Typed Accessor
boolean
smallint
integer
serial
int8
serial8
decimal (p<=28), fixed scale
Boolean
Int16
Int32
Int32
Int64
Int64
Decimal
GetBoolean()
GetInt16()
GetInt32()
GetInt32()
GetInt64()
GetInt64()
GetDecimal ()
GetIfxDecimal()
decimal (p<=28), floating
point
Double
GetDouble()
GetIfxDecimal ()
decimal (p>28)
money
String
same as decimal with
same precision
GetString()
same as decimal with same
precision
GetIfxDecimal()
GetIfxMoney ()
smallfloat, real
float, double
date
datetime
interval, year-month
Float
Double
DateTime
DateTime
String
GetFloat()
GetDouble()
GetDateTime()
GetDateTime()
GetString()
Interval, day-fraction
char(1)
char
lvarchar
TimeSpan
Char
String
String
GetTimeSpan ()
GetChar() GetChars()
GetString() GetChars()
GetString() GetChars()
IBM Corporation 2003
Informix Typed
Accessor
GetIfxDateTime()
GetIfxMonthSpan()
GetIfxTimeSpan()
Kansas City Informix User's Group
Data Types in the IDS .Net Provider
Informix Database Type .Net Framework Type .Net Typed Accessor
nchar
varchar
byte
text
blob
clob
list
multiset
set
named row type
unnamed row type
distinct
String
String
Byte[]
String
Byte[]
String
String
String
String
String
String
As the underlying type
GetString() GetChars()
GetString() GetChars()
GetBytes()
GetString() GetChars()
GetBytes()
GetString() GetChars()
GetString()
GetString()
GetString()
GetString()
GetString()
As the underlying type
IBM Corporation 2003
Informix Typed Accessor
GetIfxBlob()
GetIfxClob()
GetIfxList()
GetIfxMultiset()
GetIfxSet()
GetIfxRow()
Kansas City Informix User's Group
Classes for Informix Data Types
•
•
•
•
•
•
•
•
IfxDecimal
IfxDateTime
IfxTimeSpan
IfxMonthSpan
IfxRow
IfxComplexLiteral
IfxBlob
IfxClob
IBM Corporation 2003
Kansas City Informix User's Group
Using MTS with the IDS .Net
Provider
• Using CLR to implement COM+ configured
classes is easier than implementing them with
COM
• System.EnterpriseServices Namespace
– provides the .NET classes, interfaces, structures,
delegates, and enumerations with access to COM+
services
• ServicedComponent Class
– base class for all COM+ services
• ContextUtil Class
– wraps the CoGetObjectContext, the COM+ API for
retrieving object context
Kansas City Informix User's Group
IBM Corporation 2003
Using MTS with the IDS .Net
Provider
• Connection can be enlisted in distributed transaction
– manually
• Set IfxConnection class Enlist property to false
• Application calls EnlistDistributedTransaction() method to enlist
into the distributed transaction
– automatically
• Set IfxConnection class Enlist property to true
• Application sets TransactionOption attribute to Required or
RequiresNew
• MS DTC is still unmanaged code
– New “plumbing” minimizes some data type conversions
– Explicit resource deallocation may be required
IBM Corporation 2003
Kansas City Informix User's Group
API Tracing with the IDS .Net
Provider
• IFXDOTNETTRACE – sets the level of
tracing to be reported
– Trace levels
• 0 = no tracing
• 1 = reports API calls entry & exit
• 2 = level 1 + function parameter values
• IFXDOTNETTRACEFILE- sets the log file
where trace information is to be written
IBM Corporation 2003
Kansas City Informix User's Group
Integration with Microsoft Visual
Studio.Net
• Emphasis on improving Visual Studio.NET development
experience when using IBM (DB2 and IDS) DBMS
• IBM connections and database projects are depicted within
Visual Studio:
– Data Connections folder
– Server Explorer tab
– Solution Explorer shows IBM database projects
• Future release will add support for:
– IDS SQL Editor
– IDS Query Builder
– Content and dynamic help
IBM Corporation 2003
Kansas City Informix User's Group
Installation and Deployment
• IDS .Net Provider requires .NET framework
version 1.1
• IDS .Net Provider will be included with
CSDK (development) and I-Connect
(runtime) distributions
• Requires a stored procedure to be installed in
sysmaster database of each server instance
IBM Corporation 2003
Kansas City Informix User's Group
Roadmap of IDS .NET Support
• IDS .NET Provider completed technology preview
in Q4 ‘03
• IDS .NET Provider is currently available in the
CSDK 2.81.TC3 release
• Subsequent releases of the provider will add
additional functionality
– Release mechanism will remain via CSDK and IConnect products
IBM Corporation 2003
Kansas City Informix User's Group
Questions ?
IBM Corporation 2003
Kansas City Informix User's Group
Where to Get More Information
• IBM developerWorks Informix zone page:
(www7b.boulder.ibm.com/dmdd/zones/informix/)
• Microsoft .NET Framework home page:
http://msdn.microsoft.com/netframework
• IBM Informix .NET Provider product
documentation
• Contact us!
– [email protected][email protected]
IBM Corporation 2003
Kansas City Informix User's Group