Quick! Name three open source projects! The vast majority of us think of Linux, and that's pretty much it. Those of us who use WDSci (the WebSphere Development Studio client for iSeries) might include Eclipse. Those who program Java on the iSeries might include IBM's Java Toolbox. And after that, the pickings get mighty slim. And that makes sense, because iSeries and open source aren't exactly peanut butter and jelly.
SourceForge.net is the largest location for open source development anywhere on the 'net. This is not hype; there are currently approximately one hundred thousand open source projects registered there. Of that number, exactly seven are iSeries projects. And perhaps 20 other projects are somehow peripherally related to the box. So you can see that the iSeries is somewhat under-represented in the open source community, especially if you consider the fact that there are over 100 projects for the Amiga! But there's no reason there can't be more iSeries projects. Some nice projects do already exist. For example, David Morris' iSeries Toolkit resides there.
SourceForge may not be familiar to you, but it is really very easy to use. In this article, I will...
- Explain the new OS400Bridge project
- Outline the steps to create new open source projects on SourceForge
- Show you how to access the projects using WDSc
With these steps in hand, you'll be able to use this new open source project and then someday create and contribute your own.
The Project
The first step in creating an open source project is to identify a need. The project should appeal to as wide an audience as possible. If you're writing something that only you need, there's little point in making it open source, except perhaps for the sheer fun of it. But if you want your project to have some utility, you have to find a niche that has a demand but no current supply.
As a member of the JTOpen Core Team, I sometimes feel bad that I don't contribute much to the project. Honestly, that group is so focused and so capable that they don't need much from folks like me, and it's hard to find an area they haven't covered. But a while back, I got an email. Robert Upshall, another iSeries/Java convert like me, was asking about contributing to JTOpen. And from those discussions, our open source project, OS400Bridge, was born.
What Is OS400Bridge?
To understand the OS400Bridge project, you can go to SourceForge and read the blurb, or you can read it right here:
"OS400Bridge is intended to provide connectivity options for Java applications running on IBM's OS/400 (iSeries or AS/400 machines), allowing them to access databases throughout the network."
OS400Bridge will provide Java classes allowing a program running on OS/400 (or any other JVM-enabled OS) to use another machine as a proxy for JDBC access. In our first release, we intend to create a server running on a Windows platform, which will be accessed by a client on OS/400.
How Does JDBC Work?
The two simplest ways for a Java program to access a database via JDBC are to use either a Type 4 JDBC driver or the Type 1 JDBC/ODBC bridge. The former requires that the vendor (or some third party) release a Type 4 driver for the database in question, while the latter requires an ODBC driver. Very few vendors provide free Type 4 drivers, so the Type 1 driver is the more flexible approach. The architecture of an application using a Type 1 driver is shown in Figure 1.
Figure 1: A standard application using a Type 1 JDBC Driver works like this.
The Type 1 JDBC driver is really just a layer over the ODBC driver. The Java application can only work on a platform that has a native ODBC driver for the intended database. Unfortunately, few database vendors supply ODBC clients for OS/400.
However, nearly every vendor provides such drivers for Windows. The idea, then, is to allow OS/400 to take advantage of the wide array of ODBC drivers available for Windows. With OS400Bridge, requests on the OS/400 machine will be passed to the server running on the Windows box, which will in turn execute them using a Type 1 JDBC/ODBC bridge to the appropriate ODBC driver.
Implementation Details
The package as currently designed supports only a very limited set of operations: basically, the abilities to connect to and disconnect from a database and to execute simple updates and queries. We currently have no plans to support the more-advanced JDBC2 and JDBC3 functionalities, but that's a driving force behind making the project open source. That way, someone else can contribute those features.
Figure 2: OS400Bridge allows iSeries applications to use Windows ODBC drivers.
The package consists of a server that runs on the Windows machine (the "host") and accepts requests via TCP/IP sockets, as well as a server proxy class that the OS/400 application (the "client") uses to send requests to the server and receive results.
Our first objective is to get a simple protocol in place, so we'll probably use our own classes and methods on the client. In this sort of application, you will create a BridgeServerProxy object and send requests to it. Once the protocol is stable, we will then seek to wrapper the client classes inside the standard JDBC architecture so that you can use the standard DriverManager.getConnection() type of syntax to access the bridge.
Upcoming parts of the project include driver classes that will insulate the protocol from any ODBC differences, support for multiple databases and multiple servers, support for multiple clients, and configuration of the proxy from the client program. And of course, we will always look to extend the number of supported features.
Our goal is to provide a flexible, extensible server that can be used by any machine in the network to access databases on any other machine where such connectivity is not currently supported by the database vendor.
Why SourceForge?
So why is this project part of SourceForge instead of JTOpen? Well, the primary reason is that it really doesn't fit the JTOpen philosophy. Basically, JTOpen is more about using Java to access the iSeries, rather than using Java for the iSeries to access other things. And who knows, maybe after the project matures a little bit, the JTOpen folks will see that it really does make sense as part of the Java Toolbox for the iSeries. But for now, it's got to be a standalone project, and SourceForge is the unquestioned king of such projects.
Proving the Concept
The first thing Robert and I had to do was write enough code to make sure the concept worked. Before you start an open source project, the first thing to do is to divvy up the workload, and as it turns out the OS400Bridge project quite nicely divides itself into the server portion and the client portion. Robert took the client portion, which actually does the JDBC work, while I took the server part. I also took the communications protocol, which for now is actually pretty simple: We send a text request from the client to the server, and then the server sends the results back as a serialized object stream. This allows us to send whatever we need to send, from a Boolean to a result set to an exception. I suspect we'll use a slightly more robust protocol in a later version, but the code we have works.
And in fact, that's about where the project lies as I type this article. By the time the column is published, we may have a bit more in place, but right now all that's done is a proof of concept (well, it's a little better than that--Robert cleaned up the driver portion quite nicely, but my stuff is still really rough).
Create a Project
The next thing is to create a project on SourceForge. This isn't a detailed instruction manual, so I'll just address the major points. First, you will have to create a user. Do this using the New User via SSL option on the screen, as shown in Figure 3.
Figure 3: The SourceForge home page has an option to create a new user.
After going through a typical registration with email verification, you will be able to log back in and go to "my sf.net." After logging in, you'll see a personal page like the one in Figure 4, which will have an option to Register New Project.
Figure 4: Once you have logged in, you can register a new project.
You will need to go through many pages that explain the various ramifications of open source. On about the sixth screen, you will need to select a license type. This is a crucial choice. We selected LGPL because we want anyone to be able to use this code freely, even in commercial projects. We decided that the standard GPL license was a little too restrictive in that regard. There are constant debates in the public forums about which license to use, and you may want to take some time studying them to see which best fits your own personal philosophy of software development. You will also need to enter both short and long descriptions. Once you've done that, you will finally get to a page saying the project has been submitted for review.
Within 24 to 48 hours, you will get a response from the SourceForge folks telling you whether your project was accepted. Once the project is accepted, you will be the proud creator of a piece of open source software!
Now the Work Begins!
This is when the work actually begins. You've created the project, but you have no software. Someone has to actually upload the first cut of the software. But once that's done, the entire project is available through Concurrent Versions System (CVS), the industry standard source-control system. The nice thing about this is that WDSc is built to work with CVS.
If you decide to become a development member of the OS400Bridge project, you'll be able to attach to the repository in read/write mode, which will allow you to not only download the code, but also upload your changes. If it looks like you might like to do that, please contact me and we'll see about getting you access to the project.
Just Looking
If you just want to use the current code, you have a couple of options. The first is to wait for us to release a version of the software. By the time you read this column, we should have made some files available for download in the project's SourceForge page. Typically, we'll release a binary (a JAR containing all the classes) and a source zip file. We may also have a separate documentation file.
But if you want to play with the source yourself, you can always download the current version simply by attaching to the CVS repository. You will be able to "check out" the current version into a project in your workbench, and then you can start using the code yourself.
WDSC and SourceForge
I'll go through the steps required to attach to the CVS repository and check out the current OS400Bridge project into a project in your workspace. First, use the main menu to select Window->Open Perspective->Other. This brings up the prompt shown in Figure 5. Select the CVS Repository Exploring perspective and press OK. After this, your workbench will look like Figure 6.
Figure 5: Open the CVS Repository Exploring perspective.
Figure 6: You're in the CVS Repository Exploring perspective!
Right-click in the navigation pane (the left side, where the arrow is in Figure 6) and a pop-up menu will appear. From there, select New->Repository Location as shown in Figure 7 to bring up the repository location wizard. Enter the values as shown in Figure 8 and press Finish. You will see a repository in your application, as shown in Figure 9.
Figure 7: Create a new repository location.
Figure 8: Use the wizard to add a new CVS repository.
Figure 9: After successfully attaching to the repository, you will see the os400bridge project.
Expand the repository. You will see entries for HEAD, Branches, and Versions. Expand the HEAD entry to see the os400bridge project. Right-click on that project and select Check Out As Project, as shown in Figure 10.
Figure 10: This option will create a new project in your workbench and download the code.
At this point, if you switch to the Java perspective, you will see a new project, os400bridge, in your workbench, with all of the source members. You can copy the source from os400bridge into an existing project.
Checking Out into a Java Project
Another option is to use the Check Out As... option. With this option, you can tell WDSc what kind of project to create. Create a Java project. There's a slight problem with this, because our naming conventions currently assume that you will be using a source folder called "src," which is a convention in many projects. Use the properties dialog for the project to add a source folder called "source." If you're unsure how to do this, drop a line in the forums discussion section, and I'll outline it in a little more detail.
Running the Code
Once you've downloaded everything, you can then decide how you want to test it. As the system stands, there are capabilities to test with the AS/400 driver, which will allow you to access DB2 data on an iSeries; the MySQL driver, which will attach to a MySQL database; and an Access driver, which will allow you to read Microsoft Access databases. You will see in the os400bridge project a document called OS400Bridge Reference.doc. This file contains more details on running the software. The documentation is pretty sparse right now, but we plan to add more as time permits. Please feel free to try the code and make any comments on the forum provided at the project's SourceForge page.
That's it for this article. Please stop by the OS400Bridge project. I'll bring you up to date on its progress and on the participation of the community in a later article.
Joe Pluta is the founder and chief architect of Pluta Brothers Design, Inc. He has been working in the field since the late 1970s and has made a career of extending the IBM midrange, starting back in the days of the IBM System/3. Joe has used WebSphere extensively, especially as the base for PSC/400, the only product that can move your legacy systems to the Web using simple green-screen commands. Joe is also the author of E-Deployment: The Fastest Path to the Web and Eclipse: Step by Step. You can reach him at
LATEST COMMENTS
MC Press Online