Start to Version your PL/SQL Application with Git

Many times I participated in different Oracle database development teams there was no clear concept of how the source code should be versioned. There were many dubious practices, e.g. sharing code on file systems level, via e-mail or even directly developing and compiling in the database.

These worse practices has persuaded me to establish some approaches how you can make development in PL/SQL context more reliable.

My Creed

Maybe it seems excessive but during development there is a creed in which I believe before, during and after work time :). These very simple rules ensures that you stay revision safe in your code no matter what happens:

Some brief explanations:

Master = Production

No matter what are your doing  just ensure that your master branch always looks like the application state in your production. It is a very good feeling to be able to check on source level what is the difference between your ongoing development and your production.

In some projects, it depends on how fail-safe your team is, it could help when only a single teammate is able to merge commits back into the master.

Only File-Based Dev

As mentioned on the beginning make sure that development happens always on a corresponding script file to the object which shall be altered. Direct development (compiling) is strictly prohibited!

Some developers are really (really, really) lazy! How often I had to hear that a change can be done so easily directly in the database. My advice: Do not take account of these statements!

Development must happen revision safe. You mast always be able to say why and when someone changed a source. So do your homework properly.

The Truth is in Git

Needless to say: each source which has something to do with the software you are developing will be stored in Git or another version control system.

Avoid any code which has not been placed in Git! Or in other words: what does not exists in Git is non existing for your!

Get your Sources from DB

My above assumptions imply that you have your sources on file system in order to comply with Only File-Based Dev and The Truth is in Git. And this is what we are going to do now.

Scheme2ddl ( qwazer 2018) is a very nice Java application which helps you to get all your sources from your database. It checks which different objects (packages, table definitions, views, procedures, etc.) are stored in your database and extracts these sources as files on our file system.

After extracting these sources you can init a Git repository and bring your development on a higher level.

Configuration (XML)

The Scheme2ddl extractor can be configured. It can load a configuration XML in which you can provide some settings that will be applied during file generation.

I will not show the entire XML structure but only focus on some interesting sections/attributes:

Connection

Set your login details. You can even pass the connection and login information as arguments.

Target Schema

Set which schema you want to extract. The user must have access to these schema! Or you can login a sysdba.

Output Mapping

The source extractor allows you to customize how your files shall look like. I would not to customize to many here. Just use the value toad, lean back and enjoy. With this settings you will get for PL/SQL packages *.pkg (body) and *.pks (specification) extended files. Other types like views and triggers will also get their own extensions.

Run the Extraction

Find here attached my entire scheme2ddl.config.xml configuration. Needless to say that you need a Java runtime in order to run the extraction. Than start the extraction with the following command and check the result:

The output of the extractor:

As you can see the extractor has also put your database objects in sub directories in the output folder. Now you can start to check-in your sources in Git and start to develop (more sophisticatedly)!

qwazer, 2018, ‘Command line util for export oracle schema to set of ddl scripts’, GitHub, accessed February 18, 2018, from <https://github.com/qwazer/scheme2ddl>.

My Absolute Must to Have Git Shortcuts

Almost every developer who once started to use Git as a version control system knows how efficient you can be in the console with this tool. With very short commands one is able to check-in and check-out code faster than you think.

All needed steps to interact with your code repository can be executed on command line. There is no need to use any klikibunti ( Wikipedia 2018) (means some kind of graphical user interface) GUI. But with a right .gitconfig  file in our home directory (~) you can even become faster, much faster! But first things first

.gitconfig File

The .gitconfig file allows the user to make some personal settings which affect git and the way how you can work with the version control system (VCS). Since, I am using git for several years in different project I started to define my own aliases for the standard git commands. Aliases allow you to find a more handy substitution for the standard git commands. So instead of writing git commit -a -m "some nice commit message" you could define e.g. git cam "some nice commit message.

Better Logs

These aliases allow me to find things faster in the log. The commands shows the revision graph. Quite equivalent to that what the GUIs  gives you.

Faster Integration

The must to have commands. All standard just add in your [alias] and test these commands:

Pocket Knife

My personal (Swiss) pocket knife. If you do not know where you find a file, e.g. class, package, config, whatever, you can use these commands to find it.

Usage

If you are more interested in the content you can use another command. This will grep all files and there lines where your search terms can be located:

Let’s search for the string „abort“

Your Reminder

Have you forgotten an alias? No problem! Just list your settings with:

Wikipedia, 2018, ‘Klickibunti’, Wikipedia, accessed February 2018, from <https://de.wikipedia.org/wiki/Klickibunti>.

Conference: DOAG Forms Day 2018 21 in Berlin

I may proudly announce that I am a speaker at the DOAG Forms Day 2018 conference in Berlin.

Since, some of my listeners at the DOAG 2017 found my presentation interesting I may present the topics a second time.

This time I am going to put more focus on the approaches developing Forms more agile. I will prepare some post of my favorite tricks and tips on how you can sa

ve time during developing forms application.

Bear in mind Forms development does not mean you are not able to develop agile.

Presentation Slides

I have just finished my presentation slides for the Forms Days 2018 in Berlin. You can download the the entire presentation here. I added some slides which put more focus on the workflow with Git:

I do not only describe which features you can use from the Forms API Master but also how you can follow the standard Git workflow in your Forms development.

Some of my personal favorite slides:

Boost your Forms Development with GIT and Forms API Master (DOAG 2017)

I prepared these post as an additional bonbon for the attendees of my presentation at the DOAG 2017 in Nuremburg. Hope this will help you to get things work at your environments and development efforts.

Well, some introducing words first.

*.FMBs != Agile Development

Modern development methodologies and technics demands some kind of agile approach. Times of waterfall procedural model are now things of past and hopefully vanished completely (hopefully!).

Bear in mind that development is a highly creative process which needs the flexibility it demands. Means, as a developer I must have the opportunity to collaborate with each other, create source code simultaneously, bring things together and compare different states of artifacts at any point in the project.

weiterlesen

Conference: DOAG 2017 21 – 24 in Nuremberg

I may proudly announce that I am a speaker at the DOAG 2017 conference. The topic about which I am going to talk is how you are able to Boost up your Forms Development using a nice tool set.

I am going to present how you are able to overcome the suffering of binary *.fmb files in an agile development process. Many Oracle Forms developers are faced the problem of handling binary files. In this case diffs or merges can lead to overwhelming pain during development. To cut things short: Forms Oracle, Git and Forms API Master are the tools of choice for this task.

Using Git as your VCS (version control system) I can configure your tool of choice to handle diffs and merge conflicts. These brings you the opportunity to handle these well-known challenges during development, furthermore to accelerate your assembly process significantly. A must to have!

SQL Developer Connection to Local Database

In this tutorial I am going to  show you how you can create a connection to a local Oracle database with the SQL Developer. The SQL Developer is a very powerful and free integrated development environment (IDE) for developing and managing source code in an Oracle database (Oracle Cooperation n.d.). Even I am used to eclipse and prefer this IDE in any other development projects I have to admit that with none of the available eclipse plugins I was able to gain more benefits than with the SQL Developer.

weiterlesen

Creating Let­ters Ac­cord­ing to DIN with Latex

I have been using Latex for several years as a substitute for Microsoft Word or Libre-Office. As everyone may know, we have to write infinite letters to different – external or internal – addressees. There was a moment in the past when I was fed up with the whole ‚writing a letter‘-process. Why? Because starting Word, formatting all the different parts of the letter, seems to be more time consuming than writing the content itself.

weiterlesen

The Power of Exception Handling

In this tutorial I would like to discuss the possibilities of exception handling in PL/SQL code. In my point of view many developers do not use the exception handling appropriately and overlook the importance of it. This leads to bad code and weakness in programming design. Before I start to illustrate some of my examples I am going to give you some brief information regarding, which types of exceptions Oracle defines in its standard and how the syntax for applying them in your code could look like.

weiterlesen

Install Oracle 11gR2 Express Edition on Ubuntu 14.04 (64-bit)

Since I want to give as many as possible examples in my blog I needed to install a Oracle database on my Ubuntu 14.04 operating system first. This seems to be a very good starting point for one of my first posts.

Although Linux users are used to very handy install processes by just typing sudo apt-get ... commands the installation of an Oracle database is not as simple as that. The reason for this is that the Oracle database as an proprietary product is not provided in the public software repositories which the apt-get commands query.

weiterlesen