Disclaimer

The views and opinions expressed in this blog are my own and do not necessarily reflect those of my employer. The views and opinions expressed by visitors to this blog are theirs and do not necessarily reflect my own

Monday, December 18, 2006

FlashFiler (NexusDB) to Oracle Migration

The project I'm currently working on has required me to migrate data contained within Flash Filer2 database files (*.FF2). Although this is an old and obscure file format, others out there may well need to migrate data stored in such files to a newer, shiner DB, like Oracle.

We were supplied with a CD that contained a catalogue of data but unfortunately it was in this obscure FF2 file format. There was a front end to the data on the CD but this was pretty much useless as we needed to exploit the data in the application we were developing. After identifying the file format, the question was how to actually get at the data and make use of it in the new application. The client owned the data so copyright etc wasn't an issue, but it may be for you.

Like most databases, the flash filer database files take the form of binary file. My novel approach was to build a database instance round the files and accessing the data through a DB driver or through ODBC.
This meant there were 2 problems.
  • Getting hold of and installing the Database engine cheaply
  • Finding an ODBC driver for the database engine
I sniffed failure when I discovered the company who had produced the database engine had ceased trading. After much googling, I found that the Flash Filer DB engine had been kindly placed on source forge at http://sourceforge.net/projects/tpflashfiler and some instructions at http://www.atari-source.com/docs/turbopower/FlashFilerBasics.pdf on how to get the DB to point to the flat files so they could be accessed. If you don't read the instructions, the answer lies in creating an Alias to the directory containing the FF2 files.

Unfortunately the ffexplorer.exe supplied with the flashfiler download does not include an export function but does allow you to nicely see the the table structure. This is useful when you come to extract your data.

Again after some more goggling, I eventually found an ODBC driver at http://www.nexusdb.com/downloads/FlashFilerODBC213_r001.ZIP , which be used for free. Although unsupported, the driver sufficed and did the job nicely (tho not very quickly).
Once installed you need to set up a data source which points to your flash filer database. On NT systems go to the windows control panel (in classic view) then Administrative tools- Sources(ODBC). Click on add and select 'Nexus DB FlashFiler Driver'. Enter your connection details and give you data source a name.
The next problem I encountered was how to actually connect to the database over ODBC and grab the data. Without wanting to installing or write masses of Java, C# or Perl. I found the simplest way was to create some JScript that connected to the database and dumped out flat tab-separated text files. JScript is a Microsoft scripting language that has javascript like syntax. I have uploaded a generic version of the file which is located here and can be adapted by yourself. To run, simply type the fully qualified path and filename in a command window.

To get the data into Oracle you could use sqlldr or externalised tables, both use similar syntax. I used externalised tables and created a new table by doing create table as (select * from external_table).
When a you use an externalised table, the data is actually read from the text file and and cannot take advantage of the performance features Oracle uses, hence my reason for creating a table in this way. Granted, I could have bypassed this and used sqlldr or some other scripting language. The only thing to note is that you need to create a data directory mapping in the Database which will map to the location of your csv/tsv file file.

The files I have supplied may need to be adapted for your own use though. The JScript file was my quick and dirty solution to get a job done quickly and has no error checking. If it fails you'll get a javascript type alert saying so. All code supplied comes without warranty or guarantee.
Hope this saves someone a cool couple of hours or can find a use for this.

Wednesday, December 13, 2006

It's been about a month since my last post and I've been busy, busy, busy. I have just got back from another trip to Prague (more on that in a later post) and my stint in Consulting Customer Services is now over and the work I did for them in APEX was very well received. Since then I've been posted to my first project outside of Oracle.

It's another project involving APEX and I'm really starting to get to grips with some of the more advanced features the product has to offer. The work I am currently involved in makes the Customer Service system I worked on seem like child's play.

For those of you not familiar with APEX, the product basically sits on top of the Oracle Database (and Oracle XE) and provides a RAD web-based development environment that allows a developer to build CRUD (Create Report Update Delete) type web applications (and more) very quickly by generating all the look and feel code itself.

APEX is ideal if your primary concern is to exploit your data and concentrate on look and feel later. Custom functionality can be added by through the use of JavaScript and PL/SQL. APEX provides dozens of wizards that provide a developer with the means to create validations, sortable reports, data-entry forms, charts and security right out of the box with very little effort.

When I first started developing in APEX, it seemed to be cumbersome and very difficult to do anything even remotely complex. By this I mean the built in wizards are fantastic but can be difficult to customize to your exact needs. Knowing how and where to change settings or add functionality also proved frustrating.

After using APEX for a couple of months now, I am fast becoming a convert as my proficiency has vastly improved and I have started to combine the out of the box features with both the underlying APEX PL/SQL API's which are not immediately obvious from the development environment.

My top tips would be to experimentation combined with quick scans of the developer documentation and forums if you start to get stuck. The APEX community is really gathering speed now and has vast amounts of information can be found there. Brushing up on your PL/SQL is the only other advice I can give as this is the quickest way to produce custom functionality.

As they say in the Czech Republic Na shledanou!