When AI and containerization meet the IBM i

Rémi Rouillot

Friday 17 November 2023

  • News

Make IBM i like SQL Server or MySQL in .NET? With modern interfaces? Containerized on ARM or POWER? It's possible, thanks to AUMERIAL's NTi solution, available to everyone. The proof: even #ChatGPT can do it ;)

IBM i News

Introduction

Artificial Intelligence

The year 2023 has been marked by the dazzling progress of artificial intelligence. It has been democratized through popular tools such as ChatGPT. We now have a whole panoply of tools for producing a result from an idea or a thought.

Containerization

At the same time, we are witnessing the democratization and growing power of containerization. It has become an essential part of modern infrastructure. By setting new standards in application development, it standardizes development practices and guarantees the interoperability of all IS components. So investing in cloud-native technologies is no longer nice-to-have, but a must-have. I recommend reading this article published by Google, which highlights the importance of standardizing tools.

Where does IBM i fit into all this?

How can we end up talking about AI, containerization... and IBM i? At AUMERIAL, we've just released NTi, an IBM i access provider for .NET cloud-native, autonomous and containerizable.

In this article, I'm going to present the development and publication of a .NET web application accessing the IBM i, containerized in Docker in an ARM environment.

The writing of this application will be supervised by ChatGPT, to demonstrate the interest of this tool for even the most experienced developer. There's no question here of the developer being replaced by an AI, but rather of demonstrating the power of this tool to boost productivity in the development of .NET applications.

So we've got AI, container and IBM i.

The scenario

I need to develop a web application for booking concert tickets. The following steps are involved:

  • Designing the relational database
  • Writing data accesses (CRUDs)
  • Development of the web interface

The whole project will be developed in ASP.NET Blazor server, on a DB2 for i database, using the NTi data provider developed by AUMERIAL.

This article reviews the various stages of application design and deployment. The aim is not to present a detailed tutorial, but rather an approach to demonstrate that :

  1. The use of a virtual assistant can help the developer in his work by bringing productivity.
  2. Developing a .NET/IBM i application is as trivial a task as using any other database.
  3. AUMERIAL's NTi solution simplifies application development and enables the IBM i to be integrated into modern development schemes.

Finally, I've chosen to target an ARM architecture for this example, however without modifying the code, the application can run in a POWER or x86 environment.

Briefing with ChatGPT

I begin by explaining my approach to my virtual assistant:

article 1

Then I clearly explain my use case:

article 1

The briefing's over, we can get started!

Step 1: Creating the database

To develop this kind of application, I always start by modeling the situation and creating my data model. Then I create the various tables in my DBMS. Let's take a look at ChatGPT:

article 1

Rereading this template, I notice a few points that need to be corrected:

article 1

I'm happy with the model, now let's move on to the SQL implementation:

article 1

We copy everything into ACS to execute this script, check it and everything is created without a hitch:

article 1

All's well, the database has been created, all that's left is to develop our application!

article 1

Creating a new .NET project

We're going to create an asp.net blazor server project. We'll also add all the dependencies we'll need:

  • MudBlazor to create the interface
  • Aumerial.Data.Nti** and the Dapper ORM for access to DB2 for i

article 1

The project and its dependencies are now created. Once the project has been opened in Visual Studio (or VSCode), follow the MudBlazor installation steps.

Implementing the data access layer

Let's start with the models:

article 1

We're sticking to a very classic approach, with classes representing the various entities.

We then create the various services that implement SQL to retrieve data from the various models. As the NTi supplier exposes the ADO.NET classes, we ask ChatGPT to create an implementation based on the generic ADO.NET classes, specifying that the parameter marks for our SQL queries are the question marks, to respect the format expected by the IBM i:

article 1

I'll skip the details, but after verification and some fine-tuning of the work done by ChatGPT, we now have all the database access services, written in SQL and protected against SQL injection (use of parameters and prepared queries).

Queries are submitted directly to the IBM i via NTi, without the use of drivers such as ODBC or OLEDB. This application is therefore totally platform agnostic. This means we can easily containerize our application.

We can now move on to the interface.

Creating a modern interface

Finally, we can create our application's interface thanks to the richness and efficiency of the tools offered by .NET, in this case the MudBlazor component library.

At this stage, we need to create the various pages of our application:

  • Login/account creation page
  • Home page/display of concerts and ticket reservations
  • Display page for tickets reserved by the user
  • User profile information management page

Let's ask ChatGpt for the code for the concert display and ticket reservation page:

article 1

The code generated by ChatGPT once again does the job, although there are still a few tweaks to be made, but the basic structure is there. The result is a modern, dynamic web application:

article 1

The data is taken from our DB2 for i relational database:

article 1

Once all the pages have been developed according to this principle, our application is ready to be published in any environment supporting docker or a container orchestrator (Openshift, Kubernetes, etc.).

Step 3: Creating the Docker image

Now that we've finished developing the application, we can publish it as a Docker image. To do this, we follow the process in Visual Studio for publishing our application as a Docker image in a remote repository.

A DockerFile is created automatically:

article 1

And Visual Studio's graphical interface guides us through the various publishing stages:

article 1

Once these steps have been completed, our application is pushed into Docker:

article 1

Step 4: Starting the application in a container

In this last part, all we have to do is retrieve the application's Docker image from our server and run it. In our case, it's a single-board Raspberry pi computer based on ARM architecture. No dependencies are required, just a docker installation.

article 1

From an SSH session on this server, run the following command:

article 1

This command translates as:

Run the concertbookingapp image from the rrouillo repository in a new container named ConcertApp, exposing port 5000.

Once this command has been executed, our application starts up and can be accessed from a web browser (at address 192.168.46.31 in my case):

article 1

And the app is available:

article 1

Conclusion

In this article, we've shown that a virtual assistant like ChatGPT can be an invaluable aid in the development of an application, in this case between .NET and the IBM i.

We've also seen that with the NTi solution developed by AUMERIAL, getting to grips with the IBM i from within .NET is far from complex. The syntax is identical to that of all other database providers, and you can work with IBM i without any green screens.

Where NTi differs from other solutions is in its total integration with .NET: whatever the target architecture, our application communicates with the IBM i. This is very important if you want to be able to run .NET/IBM i workloads elsewhere than on Windows VMs... and save money in the process, with a truly modern infrastructure.

Finally, whether it's application development or publication, everything is simple, efficient and straightforward. Any developer can master these concepts and develop high-performance, state-of-the-art business applications.

Thank you for reading this article. I'll be happy to answer any questions you may have about the above topics. In a future article, I'll cover the use of more IBM i-type resources, such as CL commands and calling RPG programs from .NET with NTi..

Rémi ROUILLOT

Back