Welcome!

ColdFusion Authors: Yakov Fain, Maureen O'Gara, Nancy Y. Nee, Tad Anderson, Daniel Kaar

Related Topics: ColdFusion

ColdFusion: Article

Macromedia ColdFusion - MX to iSeries Demystified

A world-class database platform paired up with a world-class Web application server

In this article, I'll show you how to connect ColdFusion MX to an IBM iSeries (formerly AS/400) DB2 database. I'll describe your connectivity options and give you configuration examples.

While attending an iSeries conference a couple of years ago, I had the opportunity to talk with an IBM DB2 engineer. I still remember the blank look on his face when I explained that I use ColdFusion to access his database. In his defense, I've enlightened more than a few Macromedians as to what an iSeries is and what it does. Thank heaven for standards and thank the heavens again for Macromedia's and IBM's adherence to them.

There are several ways to get to DB2 data on the iSeries. We'll concentrate on ODBC and JDBC. Platform examples will include ColdFusion MX 6.1 on Windows 2000 Server and JRun/ColdFusion MX 6.1 on Apple OSX 10.1.5.

Windows 2000 Server
ODBC Configuration Step by Step Installation

To make ODBC work, you need Client Access for iSeries installed on the ColdFusion Server. Client Access for iSeries is a licensed program and is available on the media distributed with the operating system. ODBC is an option provided with the Client Access tools suite. For security reasons it's best to perform a selective setup and choose only the options you will need (see Figure 1).

 

In the iSeries world, a software patch is known as a PTF or Program Temporary Fix. I cannot stress enough how important these are. Make sure that you download and apply the latest iSeries Client Access PTFs.

Creating a System DSN for ODBC
Create a system DSN with the Windows ODBC Administrator using the iSeries Access ODBC driver. I won't cover all the settings, but I'll point out a few that will make it work better with MX Studio and Server.

Server Tab
Naming convention differences: It's best to use SQL naming instead of system or *SYS. SQL naming uses dotted notation when separating libraries and files. *SYS uses the less-common forward slash mark.

Library list: This is where you set the libraries that this ODBC connection will use to find data. While explicit paths will work in your SQL statements, the libraries will not show up in the Studio MX available libraries list for the data source.

Performance Tab
Use blocking with fetch of one row: Use this option when your application iterates through small blocks of sequential records.

Enable lazy close support: This option prevents unnecessary opening and closing of connections.

Create a ColdFusion Data Source
Open your ColdFusion server administration screen and create a new data source. The type will be ODBC Socket and the name will be the name you gave to the System DSN. Supply a profile and password, verify the data source, and you should be ready to go.

Diagnostics/Troubleshooting
This is where ODBC has bragging rights over JDBC on the iSeries. The ODBC facilities for troubleshooting application performance and connectivity are as comprehensive as they are easy to use. You can access these tools from the Windows 2000 ODBC configuration panel.

Windows 2000 Server
JDBC Configuration Step by Step

IBM provides three JDBC drivers for the iSeries: the Native JDBC driver, the JT400 or IBM Java Toolbox driver, and JTOpen, the open source driver. The native driver, while faster than the others, will only run on the iSeries JVM.

What is the IBM Toolbox for Java? What is JTOpen? What are the differences? The answer is very little. The IBM Toolbox for Java is the polished, refined older brother of JTOpen.

JTOpen is the bleeding-edge open source version of the toolbox. It includes contributions from the open source community along with the newest fixes and enhancements from IBM. JTOpen is covered by the IBM Public License. Perhaps the most significant difference between the two is how the products are supported. JTOpen's support is provided through an online forum whereas the Toolbox is supported through traditional IBM software support channels.

The Toolbox formally known as the "IBM Toolbox for Java" is the licensed version of JTOpen. It's shipped with the iSeries as part of the base operating system and can be referenced by its licensed program code 5722JC1 or 5769JC1 for OS/400 versions prior to V5R1.

IBM Toolbox for Java and JTOpen Installation

  • See www-1.ibm.com/servers/eserver/ iseries/toolbox/faq.htm#faqG and http://publib.boulder.ibm.com/iseries/v5r1/ic2924/ index.htm?info/rzahh/rzahnm04.htm for system requirements.
  • Use iSeries Operations Navigator to locate the Java Toolkit folder on the iSeries. You can find it in the QIBM/ProdData/HTTP/Public/jt400/ IFS folder. If it's not installed, have your system administrator install the licensed program 5722JC1 (V5Rx) or 5769JC1 (V4Rx).

    or

  • Download the latest JTOpen from www-1.ibm.com/servers/eserver/iseries/toolbox/downloads.htm.
  • Create a folder on your ColdFusion MX Server. To minimize the classpath length I put one in the root and called it C:JT400 or C:JTOpen.
  • Copy the contents of QIBM/ProdData/HTTP/Public/jt400/ or extract the JTOpen zip file into your new folder.
  • Using the ColdFusion administrator, navigate to Java and JVM Settings and put C:/JT400/lib/jt400.jar or C:/JTOpen/lib/ jt400.jar into the classpath box. If you have multiple classpaths, separate them with a comma (see Figure 2).

  • Stop and restart the ColdFusion MX Application Server service.
  • Under "Data & Services" on the left navigation bar, click Data Sources. In the "Add Data Source" area, give your data source a name, then choose the other driver type and click Add (see Figure 3).

     

  • CF Data Source Name = My_iSeries
  • JDBC URL = as jdbc:as400://[iSeries server name or address]/[Database Name];prompt=false; You can verify the name by entering the WRKRDBDIRE command on the iSeries. Don't forget the prompt=false. This prevents the iSeries from sending a profile/password dialog box to the ColdFusion server in the event of an invalid profile/password. Without it, the ColdFusion server could hang.
  • Driver Class = com.ibm.as400.access.AS400JDBCDriver
  • Driver Name = Optional
  • Username = Optional. You can always append this information later in your application. I use a username and password during setup and remove it when I know it works.
  • Password=Optional
  • Description=Optional

    ColdFusion is now connected to the iSeries (see Figure 4).

     

    Apple OSX
    JDBC Configuration Step by Step

    The most intriguing capability for Web developers may be OS X's built-in support for Java. OS X ships with Java2 Standard Edition (J2SE), allowing developers a native environment to deploy their Java applications.

    Connecting to the AS400 from JRun and ColdFusion

  • Open the JRun Management Console (JMC) from your browser. Click on the default server link in the "Welcome to Macromedia JRun 4" window.
  • Add a classpath to the JTOpen.jar file you installed into the root level of the hard drive. Click on Settings, then JVM Settings. In the Java VM Settings window, go to the Classpaths for Java VM area, and click the Browse button next to the New Classpath text field. Navigate to the /JTOpen4/lib/jt400.jar file and click Open. The classpath will appear in the "New Classpath" text field. Click Add, then Update at the bottom of the window.
  • Open the ColdFusion MX Administrator.
  • Under Data & Services on the left navigation bar, click Data Sources. In the Add Data Source area, give your data source a name, then choose the other driver type and click Add.
  • In the Add window, enter the JDBC URL as jdbc:as400://[iSeries server name or address]/[Database Name];prompt=false
  • The Driver Class is com.ibm.as400.access.AS400JDBCDriver. The Driver Name field is optional. Enter your AS400 username and password, and a brief description of the data source. Click Submit. You can verify that the data source is connected to the database in the Data Sources window by clicking the checkmark icon next to the data source name.
  • ColdFusion is now connected to the AS400.

    Performance Tips & Additional Settings
    Now that you have a basic connection to the iSeries, it's time to do some performance tuning. While researching this article I performed countless query tests against various driver and server settings. I quickly realized that comprehensive performance tuning was well beyond the scope of this article. I've included links to IBM documentation at the end of the article.

  • Avoid using "Select *": ODBC and JDBC will perform unnecessary field-level processing if you use only a few fields.
  • Use connection pooling: The instantiation of a new connection will result in a noticeable performance hit even on the fastest of systems. New connections to a fast iSeries took an average of 350ms to establish without connection pooling turned on.
  • Install the latest patches from IBM and Macromedia: Not only do they fix problems, they add functionality and performance. Both companies have a good track record when it comes to fixes.
  • Take advantage of DB2's stored procedures: You can call them directly from SQL.

    <cfquery name="myQuery" datasource="my_iSeries">
    { library.program('parm') }
    </cfquery>

    I'm not a DBA and I don't know all that much about packaging in DB2, but if you do and want to use it here's how to set it up:

    jdbc:as400://[iSeries server name or address]/[Database
    Name];prompt=false;libraries=*libl,mylib;extended dynamic=true;
    package=mypackage;package library=mylib;package cache=true;

    Modifying the block size and enabling data compression may also improve performance depending on your workload.

    as jdbc:as400://[iSeries server name or address]/[Database
    Name];prompt=false;libraries=*libl,mylib;block size=512;
    data compression=true;

    Conclusion
    The Java Toolkit comes with literally hundreds of Java classes that you can access using the <cfobject> tag. The simple call in Listing 1 gets disk space information.

    What a combination! A world-class database platform paired up with a world-class Web application server. Thanks to standards, ODBC and JDBC are just the tip of the iceberg when it comes to integrating ColdFusion with the iSeries.

    Acknowledgment
    I'd like to thank my coworker and Apple guru Robert Haddan. He configured, tested, and documented the configuration process on OS X.

    Additional iSeries Resources

  • Troubleshooting ODBC: http://publib.boulder.ibm.com/iseries/v5r2/ic2924/ index.htm?info/rzaii/rzaiiodbc22.HTM
  • Performance Tuning ODBC: http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/ rzaik/rzaikodbcperfconsd.htm
  • JDBC Properties: http://publib.boulder.ibm.com/iseries/v5r2/ic2924/ index.htm?info/rzahh/javadoc/JDBCProperties.html
  • Troubleshooting JDBC: www-1.ibm.com/servers/eserver/iseries/toolbox/ troubleshooting.htm#RecordLevelAccess
  • Performance Tuning JDBC: http://publib.boulder.ibm.com/iseries/v5r2/ic2924/ info/rzaha/jdbcperf.htm
  • More Stories By Jeremy Lyon Lyon

    Jeremy Lyon is the eGovernment Coordinator for the Oregon Department of Revenue. Jeremy has over 15 years of administration and programming experience utilizing systems ranging from the Timex Sinclair 1000 to the Cray XMP supercomputer.

    Comments (14)

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


    @ThingsExpo Stories
    The Internet of Things will greatly expand the opportunities for data collection and new business models driven off of that data. In her session at Internet of @ThingsExpo, Esmeralda Swartz, CMO of MetraTech, will discuss how for this to be effective you not only need to have infrastructure and operational models capable of utilizing this new phenomenon, but increasingly service providers will need to convince a skeptical public to participate. Get ready to show them the money! Speaker Bio: Esmeralda Swartz, CMO of MetraTech, has spent 16 years as a marketing, product management, and busin...
    Samsung VP Jacopo Lenzi, who headed the company's recent SmartThings acquisition under the auspices of Samsung's Open Innovaction Center (OIC), answered a few questions we had about the deal. This interview was in conjunction with our interview with SmartThings CEO Alex Hawkinson. IoT Journal: SmartThings was developed in an open, standards-agnostic platform, and will now be part of Samsung's Open Innovation Center. Can you elaborate on your commitment to keep the platform open? Jacopo Lenzi: Samsung recognizes that true, accelerated innovation cannot be driven from one source, but requires a...
    SYS-CON Events announced today that Red Hat, the world's leading provider of open source solutions, will exhibit at Internet of @ThingsExpo, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Red Hat is the world's leading provider of open source software solutions, using a community-powered approach to reliable and high-performing cloud, Linux, middleware, storage and virtualization technologies. Red Hat also offers award-winning support, training, and consulting services. As the connective hub in a global network of enterprises, partners, a...
    P2P RTC will impact the landscape of communications, shifting from traditional telephony style communications models to OTT (Over-The-Top) cloud assisted & PaaS (Platform as a Service) communication services. The P2P shift will impact many areas of our lives, from mobile communication, human interactive web services, RTC and telephony infrastructure, user federation, security and privacy implications, business costs, and scalability. In his session at Internet of @ThingsExpo, Robin Raymond, Chief Architect at Hookflash Inc., will walk through the shifting landscape of traditional telephone a...
    SYS-CON Events announced today that Matrix.org has been named “Silver Sponsor” of Internet of @ThingsExpo, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Matrix is an ambitious new open standard for open, distributed, real-time communication over IP. It defines a new approach for interoperable Instant Messaging and VoIP based on pragmatic HTTP APIs and WebRTC, and provides open source reference implementations to showcase and bootstrap the new standard. Our focus is on simplicity, security, and supporting the fullest feature set.
    BSQUARE is a global leader of embedded software solutions. We enable smart connected systems at the device level and beyond that millions use every day and provide actionable data solutions for the growing Internet of Things (IoT) market. We empower our world-class customers with our products, services and solutions to achieve innovation and success. For more information, visit www.bsquare.com.
    How do APIs and IoT relate? The answer is not as simple as merely adding an API on top of a dumb device, but rather about understanding the architectural patterns for implementing an IoT fabric. There are typically two or three trends: Exposing the device to a management framework Exposing that management framework to a business centric logic • Exposing that business layer and data to end users. This last trend is the IoT stack, which involves a new shift in the separation of what stuff happens, where data lives and where the interface lies. For instance, it’s a mix of architectural style...
    SYS-CON Events announced today that SOA Software, an API management leader, will exhibit at SYS-CON's 15th International Cloud Expo®, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. SOA Software is a leading provider of API Management and SOA Governance products that equip business to deliver APIs and SOA together to drive their company to meet its business strategy quickly and effectively. SOA Software’s technology helps businesses to accelerate their digital channels with APIs, drive partner adoption, monetize their assets, and achieve a...
    From a software development perspective IoT is about programming "things," about connecting them with each other or integrating them with existing applications. In his session at @ThingsExpo, Yakov Fain, co-founder of Farata Systems and SuranceBay, will show you how small IoT-enabled devices from multiple manufacturers can be integrated into the workflow of an enterprise application. This is a practical demo of building a framework and components in HTML/Java/Mobile technologies to serve as a platform that can integrate new devices as they become available on the market.
    SYS-CON Events announced today that Utimaco will exhibit at SYS-CON's 15th International Cloud Expo®, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Utimaco is a leading manufacturer of hardware based security solutions that provide the root of trust to keep cryptographic keys safe, secure critical digital infrastructures and protect high value data assets. Only Utimaco delivers a general-purpose hardware security module (HSM) as a customizable platform to easily integrate into existing software solutions, embed business logic and build s...
    Connected devices are changing the way we go about our everyday life, from wearables to driverless cars, to smart grids and entire industries revolutionizing business opportunities through smart objects, capable of two-way communication. But what happens when objects are given an IP-address, and we rely on that connection, sometimes with our lives? How do we secure those vast data infrastructures and safe-keep the privacy of sensitive information? This session will outline how each and every connected device can uphold a core root of trust via a unique cryptographic signature – a “bir...
    Internet of @ThingsExpo Silicon Valley announced on Thursday its first 12 all-star speakers and sessions for its upcoming event, which will take place November 4-6, 2014, at the Santa Clara Convention Center in California. @ThingsExpo, the first and largest IoT event in the world, debuted at the Javits Center in New York City in June 10-12, 2014 with over 6,000 delegates attending the conference. Among the first 12 announced world class speakers, IBM will present two highly popular IoT sessions, which will take place November 4-6, 2014 at the Santa Clara Convention Center in Santa Clara, Calif...
    Almost everyone sees the potential of Internet of Things but how can businesses truly unlock that potential. The key will be in the ability to discover business insight in the midst of an ocean of Big Data generated from billions of embedded devices via Systems of Discover. Businesses will also need to ensure that they can sustain that insight by leveraging the cloud for global reach, scale and elasticity.
    WebRTC defines no default signaling protocol, causing fragmentation between WebRTC silos. SIP and XMPP provide possibilities, but come with considerable complexity and are not designed for use in a web environment. In his session at Internet of @ThingsExpo, Matthew Hodgson, technical co-founder of the Matrix.org, will discuss how Matrix is a new non-profit Open Source Project that defines both a new HTTP-based standard for VoIP & IM signaling and provides reference implementations.

    SUNNYVALE, Calif., Oct. 20, 2014 /PRNewswire/ -- Spansion Inc. (NYSE: CODE), a global leader in embedded systems, today added 96 new products to the Spansion® FM4 Family of flexible microcontrollers (MCUs). Based on the ARM® Cortex®-M4F core, the new MCUs boast a 200 MHz operating frequency and support a diverse set of on-chip peripherals for enhanced human machine interfaces (HMIs) and machine-to-machine (M2M) communications. The rich set of periphera...

    SYS-CON Events announced today that Aria Systems, the recurring revenue expert, has been named "Bronze Sponsor" of SYS-CON's 15th International Cloud Expo®, which will take place on November 4-6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Aria Systems helps leading businesses connect their customers with the products and services they love. Industry leaders like Pitney Bowes, Experian, AAA NCNU, VMware, HootSuite and many others choose Aria to power their recurring revenue business and deliver exceptional experiences to their customers.
    The Internet of Things (IoT) is going to require a new way of thinking and of developing software for speed, security and innovation. This requires IT leaders to balance business as usual while anticipating for the next market and technology trends. Cloud provides the right IT asset portfolio to help today’s IT leaders manage the old and prepare for the new. Today the cloud conversation is evolving from private and public to hybrid. This session will provide use cases and insights to reinforce the value of the network in helping organizations to maximize their company’s cloud experience.
    The Internet of Things (IoT) is making everything it touches smarter – smart devices, smart cars and smart cities. And lucky us, we’re just beginning to reap the benefits as we work toward a networked society. However, this technology-driven innovation is impacting more than just individuals. The IoT has an environmental impact as well, which brings us to the theme of this month’s #IoTuesday Twitter chat. The ability to remove inefficiencies through connected objects is driving change throughout every sector, including waste management. BigBelly Solar, located just outside of Boston, is trans...
    SYS-CON Events announced today that Matrix.org has been named “Silver Sponsor” of Internet of @ThingsExpo, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Matrix is an ambitious new open standard for open, distributed, real-time communication over IP. It defines a new approach for interoperable Instant Messaging and VoIP based on pragmatic HTTP APIs and WebRTC, and provides open source reference implementations to showcase and bootstrap the new standard. Our focus is on simplicity, security, and supporting the fullest feature set.
    Predicted by Gartner to add $1.9 trillion to the global economy by 2020, the Internet of Everything (IoE) is based on the idea that devices, systems and services will connect in simple, transparent ways, enabling seamless interactions among devices across brands and sectors. As this vision unfolds, it is clear that no single company can accomplish the level of interoperability required to support the horizontal aspects of the IoE. The AllSeen Alliance, announced in December 2013, was formed with the goal to advance IoE adoption and innovation in the connected home, healthcare, education, aut...