Blog

Recently on the REDDIT DB2 forum someone raised a question (found here) about DB2’s future in application development. The question and answers talked about the database industry and the reason DB2 is positioned in the upper right quadrant in the latest Gartner Magic Quadrants found here.

To address some of those concerns, here are five ways I developed and used to help application developers use DB2 for all their the new projects. Since application developers are always time and technology challenged, it is best to help them as much as possible and provide examples on how best to the access DB2 database information easily. With all the data available within your organization, making your DB2 data easily consumable is a good way to support developers, promote DB2’s superior performance, and support more data and applications.

Here are five ways to make your DB2 data so delicious so that application developers can are eager to consume it.

1.) Provide SQL access examples for your databases, especially the complex JOINs. Within every database, there are usually groups of tables related to the focus of your business. For example in retail, it could be customer, stores, or products. In most normalized designs, for example, a normalized customer table with will have additional related customer detail tables such as customer address, customer profile, and customer orders. Detailed reports or web interfaces require gathering all of this information, so performing a Customer Level or Order Detail DB2 SQL JOIN of this information is common.

Create examples of these DB2 SQL JOINs for Customer Level or Order Detail information and let the application developers know where to find and how to use them. Capture and explain these prewritten example DB2 application modules from existing projects’ code, DB2 stored procedures, or DB2 Java ORM data objects. Access to these DB2 SQL JOINs which have verified good performance and standard DB2 SQL is a win-win for the DBAs and the application developers.

2.) Show example Java, C+, JSON, and other application language code for database access. Having examples of DB2 SQL JOINs in your environment is great for application developers, but also having entire application programs examples in all the different application languages that your company leverages is huge time saver for developers. New application programs with the latest DB2 JSON, DB2 RESTful or DB2 Python interfaces in them show how easily DB2 can reference any types of data through the latest industry application programming interface. Below are some links to some program examples to help you develop your own for databases within your company.

DB2 C/C++ example here

DB2 JSON example here

DB2 Python example here

3.) Document standard database application error handling and diagnosis information. Having the full programs as examples for your application developers is usually the best because then common DB2 connection modules and common subroutines are fully listed. One of the most important types of DB2 subroutine or DB2 interface is the checking of the DB2 SQL return code or error codes when interfacing with DB2, web servers, third party interfaces or any Internet of Things interface. Proper DB2 SQL error checking and interface error handling is vital for data integrity, so make sure to provide good examples for your common application programming languages.

During my consulting performance reviews of Java applications, I continued to be amazed by poor DB2 Java error handling, so I finally published a standard DB2 Java error routine that properly provides the Java SQLExceptions details within the application code a while back. You can reference it here. Use this and verify your company is using standard DB2 SQL error handling modules within all your different languages.

4.) Provide examples of the hard data access DB2 SQL XML node value extract and DB2 SQL BLOB/CLOB access interfaces. One of the best varieties of DB2 SQL sample code and examples is within the “DB2 Demo” program. I mentioned the DB2 Demo program from IBM’s George Baklarz in my recent blog “IDUG DB2 Trip Report” that you can find here. George’s DB2 Demo program is here. Within the DB2 Demo program, there is an entire section on the DB2 SQL XML examples and a wide variety of DB2 XML features, DB2 XML functions, XQuery examples, and sample XML tables. Use these DB2 SQL XML examples as a basis to develop your own examples for your application developers to reference to use against your database tables.

5.) Offer batch-processing commit and restart capabilities application code examples. Another good reason to provide entire application program source code is that it lets everyone browse all the complicated batch-processing commit, restart subroutines, and programming logic. The batch-processing and restart capabilities and their subroutines capabilities can get tremendously complex, given the number of database tables, flat files, or other objects that need to be kept in sync. Learning and copying from existing production source code can be a tremendous help and cut down on the overall development and debugging time.

Find several examples of good processing and restart capabilities with different interfaces and a different number of objects to keep in sync through a restart. You and the application developers will have a much easier time verifying the source code and the integrity of your processing as it is tested and promoted to production.

Documentation has never been popular and is becoming harder to develop. Now that every project is agile, it seems that project documentation is an almost obsolete idea. Make your DB2 data delicious and provide application DB2 SQL development with numerous comprehensive examples to solve any processing design and to help your application developers jump start their DB2 application project. Publish other ways you are encouraging your company to use DB2 as your database of choice. Help everyone else out by adding your information in the comments section below.