You are here

Application Migration - Part 2

In our previous post, Application Migration -Part 1, we introduced application migration for change of database. In the examples, we cited Sybase to Oracle. In this post, we will introduce the way we can scan the application for items of interest and report on those with Oracle SQLDeveloper. In our third post, we will replace and translate the items found so we can run the application in Oracle.

Since SQL Developer 3.1 we have had the ability to scan source files and replace the items we find with appropriate changes.

The application migration functionality uses XML rules to define the type of files to be scanned and the type of changes which should be made. The tool uses regular expressions defined in XML to scan the application. Lets look at these in stages. There are a few parts of the tool which needs to be defined.

Recognizer - A recognizer is used to identify the types of files which are supported.

Rules - Rules are ways to define regular expressions which can identify your statements or clauses that you want to identify

Replacements - what types of replacements you want to do. We can do the following

Text replacement: Replace the item found by the with another string

Translator: Use a built in translator from SQL Developer to translate the string identified

Now, we can see the scanner knows what type of file it has. It can now use that type to identify rules which we will specify to identify the items in the file.

description="" source="sh" codetype="sql">

For a rules file, we need to define a ruleset which contains the rules. There are two parts to it, a required section and a rules section. The required section defines an expression which will be used to test the file to see if we should use the rules that are defined. In this case, we have just defined a keyword to identify before we look at anything. The rules section then defines some expressions which are used to identify some statements. In this example, we have a select statement expressions which is really simple to illustrate the point.The other interesting points here are the 'source' attribute on the ruleset which defines the type of source files these rules should be used against. The second one is the 'type' attribute which defines the database type for the application.We can either have two files with a recognizer in one and rules in another. Or, you can merge the rules and the recognizer in one rulesfile>

We can use the same command as earlier to scan with these rules now to see if we find something in the file. Now, I have added other rules which search for each artifact to be changed, but the process is the same.

So, we now have found all the statements identified that we want to translate or change for the translation.

In Summary, we have defined a recognizor to identify the file types we want to look at, we've defined some rules to identify the things we want to change.

Running the scanner with these rules against our source file, we showed in Application Migration -Part 1, we have found several things to change. In the next instalment, we'll show you how to change the things you found to run against our oracle database.