Title: DB1: Understanding and Leveraging the Latest ODBC and JDBC Technology
1DB-1 Understanding and Leveraging the Latest
ODBC and JDBC Technology
- Whats new in OpenEdge 10.1A?
Rob Steward
Director of Software Development
2Agenda
Whats New in 10.1A?
- ODBC architecture changes
- ODBC Unicode functionality
- JDBC architecture changes
- JDBC JTA support
3Agenda
Whats New in 10.1A?
- ODBC architecture changes
- ODBC Unicode functionality
- JDBC architecture changes
- JDBC JTA support
4ODBC Classic Architecture
Application Code
Driver Manager
ODBC Driver A
ODBC Driver B
ODBC Driver C
- Data Protocol
- Wire Protocol
5ODBC Wire Protocol Architecture
Application Code
Driver Manager
ODBC Driver A
ODBC Driver B
ODBC Driver C
OpenEdge Wire Protocol Driver
- Higher Performance
- No Dependencies
- Thin client install
- Data Protocol
- Wire Protocol
6OpenEdge Wire Protocol Advantages
- Ease of Deployment
- Versioning
- 10.1A will be forward compatible with future
versions of the database - Better performance
7How Database Middleware Works
DBMS SERVER
API CALL
DATABASE
NETWORK
DRIVER
NETWORK
8Why better performance?
Application makes a call
DBMS SERVER
Packets sent from driver
API CALL
DATABASE
DRIVER
NETWORK
Only one network read to process all packets.
This occurs simultaneously as the DBMS server
sends more packets
Packets sent back from DBMS Server
NETWORK
BUFFER
different sized packets
Private BUFFER
9ODBC Wire Protocol Availability
- New driver available in 10.1A!
- Compatible with 10.1A servers
- Platforms
- Windows 98/Me/NT/2000/XP/2003
- AIX
- Solaris
- HP-UX
10Agenda
Whats New in 10.1A?
- ODBC architecture changes
- ODBC Unicode functionality
- JDBC architecture changes
- JDBC JTA support
11What is Unicode?
- One character set standard to rule them all
- A single encoding standard to represent all
written characters-glyphs - Unicode 4.0 contains over 96,000 characters
- Three Common Flavors
- UCS-2 (strictly 2 bytes)
- UTF-8 (1 to 4 bytes preserves ASCII favored by
Unix) - UTF-16 (UCS-2 surrogates)
12Why Unicode?
- Internationalizes your code
- Performance can avoid costly character set
translations
13Unicode Support in the ODBC Standard
- Unicode support added in version 3.5
- Spec assumes UCS-2
- Separate API calls for Unicode strings (W
functions) - Separate data types for Unicode strings
(SQL_C_WCHAR) - ODBC Driver Manager masks driver and application
differences
14What does Unicode Support Encompass at the ODBC
API level?
- Arguments to API functions/methods
- String parameters
- String results
15How does Unicode work in ODBC?
- Unicode App vs. non-Unicode app.
- W functions
- Unicode Driver vs. non-Unicode driver.
- SQLConnectW exported?
16How does Unicode work in ODBC? (cont.)
- DM tries to make all possible combinations work.
- ANSI App w/ ANSI driver
- Unicode App w/ Unicode driver
- ANSI App w/ Unicode driver
- Unicode App w/ ANSI driver (obvious limitations)
- Unix Only UTF8 app w/ UTF-16 driver.
- Unix Only UTF-16 app w/ UTF8 driver.
17Why are Character Set Conversions Bad?
- Degrades performance.
- Frequently data is lost (Substituted), or
corrupted during conversions. - For example, heres how the Euro character, ,
is represented in various character sets - ISO8859-1 N/A
- Cp1252 0x80
- UCS-2/UTF-16 0x20AC
- UTF-8 0xE2A2AC
18When are Conversions Necessary and Why?
- Conversions by DM
- Non-Unicode apps
- Non-Unicode drivers
- Conversions by Unicode Driver
- Between Unicode and DB codepage for SQL when DBs
codepage is not Unicode - Conversions for parameters and result columns as
necessary based on C type and SQL type
19Agenda
Whats New in 10.1A?
- ODBC architecture changes
- ODBC Unicode functionality
- JDBC architecture changes
- JDBC JTA support
20Architecture differences in JDBC drivers
- The JDBC specification formally defines 4
different types of drivers - Type 1 JDBC-ODBC bridge
- Type 2 partial Java driver
- Type 3 pure Java driver for database middleware
- Type 4 pure Java driver for direct-to-database
21JDBC Architecture Type 1
- Authored by DataDirect
- Free with JDK
- JDBC 2.0 API
- For Prototyping
22 JDBC Architecture Type 2
Application Code
JDBC Driver A
JDBC Driver B
JDBC Driver C
23JDBC Architecture Type 4
Application Code
JDBC Driver A
JDBC Driver B
JDBC Driver C
OpenEdge 10.1A Type 4 Driver
- No Client Dependencies
- More Platforms
- Better Performance
24JDBC Architecture
- OpenEdge 10.1A Driver
- Type 4
- JDBC 3.0 API
- CTS Certified
25OpenEdge Type 4 JDBC Advantages
- Ease of Deployment
- Versioning
- No dependence on native code
- No platform dependence
- Any J2SE 1.4 or higher
- Better performance
26Agenda
Whats New in 10.1A?
- ODBC architecture changes
- ODBC Unicode functionality
- JDBC architecture changes
- JDBC JTA support
27What is JTA?
- JTA is the Java Transaction API
- JTA specifies standard Java interfaces between a
transaction manager and the parties involved in a
distributed transaction system the resource
manager, the application server, and the
transactional applications. - JTA is based on the XA specification
28Why is JTA important?
- All common application servers support XA
transactions through JTA and they will use them
if necessary and available - If you need to enlist OpenEdge connections in a
distributed transaction with some other data
source
29How Does JTA work?
1 UserTransaction javax.transaction.UserTransactio
n Provides the application the ability to
control transaction boundaries. It starts a
global transaction and associates the transaction
with the calling thread.
2 TransactionManager javax.transaction.Transaction
Manager Allows the application server to control
transaction boundaries on behalf of the
application being managed.
3 XAResource javax.transaction.xa.XAResource A
Java mapping of the industry standard XA
interface.
30A Distributed Transaction with JTA
- . . .
- xaDS getDataSource()
- xaCon xaDS.getXAConnection("jdbc_user",
"jdbc_password") - xaRes xaCon.getXAResource()
- con xaCon.getConnection()
- stmt con.createStatement()
- xid new MyXid(100, new byte0x01, new
byte0x02)
31A Distributed Transaction with JTA
- xaRes.start(xid, XAResource.TMNOFLAGS)
- stmt.executeUpdate("insert into test_table values
(100)") - xaRes.end(xid, XAResource.TMSUCCESS)
- ret xaRes.prepare(xid)
- if (ret XAResource.XA_OK)
- xaRes.commit(xid, false)
-
- ...
32Questions?
33Thank you foryour time
34(No Transcript)