+ All Categories
Home > Documents > Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database...

Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database...

Date post: 06-Mar-2018
Category:
Upload: doanduong
View: 232 times
Download: 0 times
Share this document with a friend
22
Java Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein
Transcript
Page 1: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

Java Database Connectivity with IBM iSAP on IBM i Porting Team Dorothea Stein

Page 2: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 2

JDBC Interface - Java DataBase Connectivity

• Interface for the relational Datenbase access from Java. The Interface covers the Java packages java.sql and javax.sql.

• JDBC is the basis for object-relational database entrances such as EJB, JPA, JDO, …

• The so-called JDBC API version determines the power of the interface and is directly coupled to the JVM/JDK version:

JDK 1.4 JDBC 3.0 SAP Basis Release 6.40 and 7.0xJDK 5.0 JDBC 3.0 SAP Basis Release 7.10 and 7.11JDK 6.0 JDBC 4.0 SAP Basis Release >= 7.20

• Implementation of this interface, the JDBC Driver, is typically coming fromdatabase manufactures but it could also come from third party distributors.

• The idea behind: Besides establishing the connection, which is configurable, programming is relatively “driver independent against the JDBC interface”.

Open SQL for Java

Page 3: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 3

JDBC on IBM i

• IBM offers three JDBC drivers for the access to IBM i: „IBM Toolbox for Java / JTOpen“, „IBM Native JDBC Driver“, „IBM JCC“

• Third party distributors offer additional drivers, for example „HiT JDBC/400“• Toolbox and Native Driver are built and maintained by IBM Rochester. The

drivers are optimised for IBM i. SAP on IBM i supports Toolbox and Native JDBC Driver.

• Toolbox / JTOpen is a type 4 driver, this means that the client side is composed 100% out of Java (and it uses TCP/IP for the connection to the database server)

• Native Driver is a so-called type 2 driver, this means it uses native operating system parts for performance optimization on the client side.

Only applicable, when the client also uses IBM i as the operating systemRestrictions with Configtool (SAP Note 657117)

• That happens usually with 2-tier SAP installationsRestriction on such scenarios without validation of DRDA

.

Page 4: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 4

Native JDBC Driver – A To Be Discontinued Model

(De-)Motivation:• According to experience from the last 10 years: Java performance is not

dominated by database access. • Not released for SAP JVM• Already mentioned limitation to 2-tier IBM i scenarios

• Consequence: Gradual elimination of support• There has never been support for such SAP releases that run with

SAP JVM 5 and higher. That means products based on SAP basis release7.1 and higher.

• Discontinuation of the Native Driver for old releases with migration toSAP JVM 1.4.

• No support for EHPI installations with target 7.0x, since EHPI is itself using SAP JVM.

We recommend that you change your driver soon!

Page 5: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 5

Driver Portrait: Toolbox / JTOpenIBM Toolbox for Java

• It is delivered as a license program and already patched.• Until V6R1: 57xxJC1 ("IBM Toolbox for Java„)• From IBM 7.1: 57xxSS1, Option 3 („Extended Base Directory Support“)

• The JDBC 3.0 version: /QIBM/ProdData/HTTP/Public/jt400/lib/jt400.jar

• The JDBC 4.0 version: /QIBM/ProdData/HTTP/Public/jt400/lib/java6/jt400.jar

Caution: Identical Naming!

The current IBM patch strategy: The driver is identical for all the IBM i releases that are in maintenance at the release time for the patch. The driver is able to connect downward-compatible to all IBM i releases supported by IBM currently.

Page 6: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 6

Driver Portrait: Toolbox / JTOpenJTOpen

• JTOpen is the codeidentical open sourceversion of the IBM Toolbox

• Download from http://jt400.sourceforge.net/

• Full IBM support

Page 7: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 7

Driver Portrait: Toolbox / JTOpenJTOpen

JDBC 3.0 version:jtopen_x_y.zip (Default)

JDBC 4.0 version:jtopen_x_y_jdbc40_jdk6.zip

Page 8: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 8

Driver Portrait: Toolbox / JTOpenSAP Integration

• For SAP basis release >= 7.0 is valid: SAP installations including dialog instances use by standard the driver under /QFileSvr.400/<SAPGLOBALHOST>/sapmnt/<SID>/SYS/jdbc/tbx/jt400.jar

• SAPinst stores there a physical instance of the driver.• In SAP basis release 6.40 Windows dialog instances use local copies.

Also when the Toolbox is used, the PTF process is not enough!

Tip: Replacing of the driver by a symbolic link on the PTFlocation on <SAPGLOBALHOST>:

ADDLNK OBJ('<driver_path>/jt400.jar')NEWLNK('<SAPGLOBALHOST_path>/jt400.jar')

Page 9: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 9

Driver Portrait: Toolbox / JTOpenDetermination of the Driver Version

• You determine the driver version in the following way from a shell:java –classpath /usr/sap/<sid>/sys/jdbc/tbx/jt400.jar

utilities.AboutToolbox

IBM Toolbox for Java:Open Source Software, JTOpen 7.3, codebase 5770-SS1 V7R1M0.03 2011/01/14 @B5Supports JDBC version 3.0Toolbox driver version 9.4

For newer SAP JEE patch levels, the driver version is described also in the console log of the bootstrap (/usr/sap/<sid>/<inst>/work/jvm_bootstrap.out) (For more information, see SAP Note 1164640).

SAP Note 654800, section 22 („Special notes about individual driver versions”) lists known driver problems.

Page 10: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 10

Driver Portrait : Toolbox / JTOpenConfiguration Using URL

• Three configuration parts:• Driver file: /usr/sap/<sid>/sys/jdbc/tbx/jt400.jar• Driver class: com.ibm.as400.access.AS400JDBCDriver• URL: jdbc:as400://<Database_Host>;<Parameter (also iASP Info)>

• What happens? • JVM is asked to load the driver class. It therefore searches all files in the class path for

it:Class.forName(„com.ibm.as400.access.AS400JDBCDriver“);

• While the connection is being established, the DriverManager class of the JVM searches for a driver class which fits to the URL and asks it to establish a connection to the given target:

java.sql.Connection con= java.sql.DriverManager.getConnection(<url>, <user>, <pwd>);

Page 11: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 11

Driver Portrait: Toolbox / JTOpenConfiguration Using URL

• SAP JEE uses the already introduced URL method to establish a pool of physical database connections.

• The configuration of the driverclass and entrance data(URL, user, password) takesplace centrally in the Secure Store, accessible via theConfigTool.

List of the current parameters: SAP Note 654800

Page 12: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 12

Driver Portrait : Toolbox / JTOpenConfiguration Using URL

• Which driver file is to be loaded, is configured in various, different places depending on the SAP release.

• In the ConfigurationsEditor per instance:

• Bootstrap • Server• Dispatcher

• In addition:• SDM• SAP Profil• ConfigTool• …

Page 13: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 13

Help, I Must Change My JDBC Driver!CONFIGJVM SCOPE(*JDBC)

• The exchanging of an existing Toolbox Driver by a new version, also a JDBC API version, is simple, since all configuration parameters stay the same.

• Changing from Native Driver to Toolbox (or reverse) is however complicated and error-prone.

• In order to avoid errors caused by the conversion, CONFIGJVM is expanded for this task for SAP releases 6.40 to 7.02. SAP Note 826449 describes the manual procedure and also the functions of this tool.

Page 14: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 14

Help, I Must Change My JDBC Driver!CONFIGJVM SCOPE(*JDBC), Example

• Prerequisites:• The SAP system complies to the prerequisites mentioned in SAP Note

1161275 to run CONFIGJVM SCOPE(*JDBC).• Current patch level for CONFIGJVM, ILE, and/or J2EEKRN are present.• The driver to be used in the future is found in /usr/sap/<sid>/jdbc/tbx.

• Preview:

CONFIGJVM SCOPE(*JDBC) ACTION(*PREVIEW) DRIVER(*TBX)

From the log file configJVM__<dd>_<mm>_<yy>__<hh>_<mm>.log in the directory /usr/sap/<sid>/<inst>/j2ee/configjvm/log, the necessary changes for the respective instance can be reconstructed.

Page 15: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 15

Help, I Must Change My JDBC Driver!CONFIGJVM SCOPE(*JDBC), Example

• Conversion:• Shut down SAP JEE• Call

CONFIGJVM SCOPE(*JDBC) ACTION(*APPLY) DRIVER(*TBX)

Original configuration is exported pro instance to/usr/sap/<sid>/<inst>/j2ee/configjvm/store and can be restored again later using the following command:

CONFIGJVM SCOPE(*JDBC) ACTION(*RESTORE)DATETIME('__<dd>_<mm>_<yy>__<hh>_<mm>')

• Perhaps the following configuration files must be manually adjusted, becausethey do not get saved in the database:/usr/sap/<sid>/<inst>/j2ee/cluster/instance.properties/usr/sap/<sid>/<inst>/j2ee/cluster/instance.properties.vmprops

Page 16: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 16

Help, I Must Change My JDBC Driver!What Can Go Wrong

java.sql.SQLException: No suitable driver

Secure Store contains inconsistent data: The given driver class is found in theclasspath, but does not correspond to the indicated URL.

java.lang.ClassNotFoundException:com.ibm.as400.access.AS400JDBCDriver

jt400.jar could not be found in the classpath. Possible causes:• After switching from the Native Driver to Toolbox, someone forgot to adjust the

classpath to jt400.jar• jt400.jar no longer exists under the indicated position in the classpath.

Page 17: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 17

Driver Portrait : Toolbox / JTOpenSAP JEE Connection Pool

• SAP JEE used the already introduced URL method to establish a pool of physical database connections. JEE applications may then logically request such a connection without the necessity to open a physical connection.

• To view the settings of the connection pools, do the following:

• < 7.10: Visual Administrator <Server Nodes>JDBC Connector

• >= 7.10: NetWeaver Administrator (http://<host>:5<inst>00/nwa) Configuration Management Infrastructure Application Resources

• Changes happen via the dbpool service of the ConfigTool.

Page 18: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 18

Driver Portrait: Toolbox / JTOpenSAP JEE Connection Pool

Page 19: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 19

Driver Portrait: Toolbox / JTOpenSAP JEE Connection Pool

Page 20: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 20

Driver Portrait: Toolbox / JTOpenIBM i Connection Pooling

• Toolbox / JTOpen uses on the database side the so-called Host Server component

• Associated jobs are called by standard QZDASOINIT and run in the subsystem QUSRWRK. As they are prestarted jobs, they can be configured as such, although that is not necessary. At least for applications, which use the pooling of the SAP JEE server.

• Changing the defaults: CHGPJE SBSD(QUSRWRK) PGM(QZDASOINIT)

Page 21: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 21

« Homework »: Open SQL Monitors and Data Browser

• SAP offers a set of analysis tools for database performance and database problems regarding Open SQL applications, similar to ABAP:

• SAP basis release < 7.10: http://<Host>:5<Instanz_Nr>00/OpenSQLMonitors/index.html

• From basis release 7.10:http://<Host>:5<Instanz_Nr>00/nwa

Problem Management Database Open SQL Monitors• Tools:

• Connection Monitor – SQL statements in cache and cache hit ratio• Open SQL Statistics – Performance statistics for SQL statements• SQL Trace – Equivalent for ST05• Table Statistics Monitor – Modifications by table• …

• Monitoring: Central out of the ABAP DBA Cockpit (for example Solution Manager)

Page 22: Java Database Connectivity with IBM i - Community Archive · PDF fileJava Database Connectivity with IBM i SAP on IBM i Porting Team Dorothea Stein

© 2011 SAP AG. All rights reserved. 22

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice.

Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.

Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.

Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.

Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries.Oracle is a registered trademark of Oracle Corporation.

UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.

Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc.HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.

Java is a registered trademark of Sun Microsystems, Inc.

JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer, StreamWork, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.

© 2012 SAP AG. All rights reserved

Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company.

Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Sybase, Inc. Sybase is an SAP company.

All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.The information in this document is proprietary to SAP. No part of this document may be reproduced, copied, or transmitted in any form or for any purpose without the express prior written permission of SAP AG.

This document is a preliminary version and not subject to your license agreement or any other agreement with SAP. This document contains only intended strategies, developments, and functionalities of the SAP® product and is not intended to be binding upon SAP to any particular course of business, product strategy, and/or development. Please note that this document is subject to change and may be changed by SAP at any time without notice.

SAP assumes no responsibility for errors or omissions in this document. SAP does not warrant the accuracy or completeness of the information, text, graphics, links, or other items contained within this material. This document is provided without a warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement.SAP shall have no liability for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. This limitation shall not apply in cases of intent or gross negligence.

The statutory liability for personal injury and defective products is not affected. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Web pages.


Recommended