Subtle Lock in - liberating my data from Notes Databases

My fun with exporting data from Notes continues. I've finished constructing my "SQL insert script view" so that it now outputs a SQL script full of inserts which are compatiable with SubText's SQL database schema. The view basically contains a single computed column containing @Functions that build a single output string which looks suspiciously like a SQL insert statement. I went into my view, exported the data, and run the output file as a .SQL script. The script runs, however it needs a bit of manual massaging after the export due to a few extra escape characters that somehow managed to appear. The weird thing is that some rows are fine, and others aren't. I'm not sure why this is, but I've tried all of the export options and none of them presented me with output that was usable without a lot of data massaging.

In case you're interested, here's the code for the computed column. There are a couple of fields there (such as txtTechnoratiTags and FakeFileName) which are very specialised to the software that the source site runs (completely custom written), however you can see the basic idea.

utcDateTime := @Text(@Year(@Created)) + "-" + @Right("0" + @Text(@Month(@Created)); 2) + "-" + @Right("0" + @Text(@Day(@Created)); 2) + " " + @Right("0" + @Text(@Hour(@Created)); 2) + ":" + @Right("0" + @Text(@Minute(@Created)); 2) + ":00.000";techTags := @If(TechnoratiTags != ""; "<p>Technorati tags: " + txtTechnoratiTags + "</p>"; "");"insert into subtext_Content (Title, DateAdded, PostType, Author, Email, BlogId, DateUpdated, [Text], PostConfig, EntryName, DateSyndicated) VALUES(" + "'" + @ReplaceSubstring( Title; "'"; "''" ) + "', " + "'" + utcDateTime + "', " + "1, " + "'Ross'" + ", " + "'ross@somewhere.com'" + ", " + "0, " + "'" + utcDateTime + "', " + "'" + @ReplaceSubstring( @Implode(Body; @NewLine); "'"; "''" ) + techTags + "', " + "93, " + "'" + @ReplaceSubstring( FakeFileName; "'"; "" ) + "', " + "'" + utcDateTime + "')"

Given how badly all of the basic exports were mangling my data, I decided to write a quick agent to export that column alone. I could have duplicated my @Function above in LotusScript, but decided that would be fairly pointless. I'm also trying to do this while spending as little time as possible using Notes, so the thought of re-doing my @Functions in Script simply seemed like a waste of time. So I wrote a quick and nasty agent to traverse view entries and simply spit out the contents of that one column alone. In it's quick, nasty, and full of hardcoded content form it looks like this:

Sub Initialize
    
    Dim session As New NotesSession
    Dim w As  NotesUIWorkspace
    
    Dim thisdb As NotesDatabase
    Dim view As NotesView
    
    Set thisdb = session.CurrentDatabase
    Set view = thisdb.GetView("sqlexport")
    Set vn = view.CreateViewNav
    
    Set ve = vn.GetFirst
    
    Dim fileHandle As Integer
    fileHandle = Freefile
    
    Open "c:\test.txt" For Output As #fileHandle
    
    While Not (ve Is Nothing)
        Print #fileHandle, ve.ColumnValues(3)
        Set ve = vn.GetNext(ve)
    Wend
    
    Close #fileHandle
End Sub

The output of these 2 combined is SQL which I can run to populate an empty SubText database with all of the html (even if some of the img tags wont work) in my existing source database. It's a bit nasty, and a bit hacky, but it will do the job - however, how the hell is anyone going to do this if they're not a developer who's semi capable in both platforms?

While playing about with this I had thoughts of writing an application to perform this work en masse for other databases. The idea being you point the tool at a database, select a form, and enter some mapping information against the fields you wish to migrate (target field name, target data type, etc). The tool would then prompt you for a view containing your source documents, and run through generating a SQL script. I thought about this for all of 10 minutes before ruling it out due to the serious limitations it would have:

  • The app wouldn't be able to handle Rich Text fields. Sure, I could create a text only abstract version and insert that, but all formatting, objects, and attachments would be lost. I suspect this would be unacceptable.
  • For it to be useful against any semi-complex Notes applications, you'd really want to find a way to work on any child documents and restore the heirachy in the target database. This is more work than I was prepared to put in (and all MY data is flat!)
  • The thought of doing more than 15 mins worth of coding at a time in Notes is a real turn off.

(Having said that, if there's high demand out there I could still be convinced, so please leave a comment if this is something you might have a use for.)

So where does this leave me? I have a way of getting historical text based data out of my source website database, and porting it into Subtext. The method is adaptable so that I could use it against other Notes databases, but it'd require a bit of developer tweaking here and there. It's not something which would work for Rich text data, and it's not the sort of process that someone who isn't fluent in SQL scripts as well as Notes/Domino development would want to be spending time with. My data will be liberated.

While doing all of this, I couldn't help but think of various conversations I've read in past years about 'vendor lock in'. During all of my years using Notes I'd never stopped to think about how proprietary Rich Text fields were. For a few years, I just used them. Around 1999/2000 I started trying to put rich text fields on the web, and started to see that there was a translation process there which didn't always go as smoothly as planned - that should have been all the warning I needed. It seems that wasn't the case. I can be a bit stubborn at times.

Every vendor wants to keep it's customers using their software. Why spend time developing products to help customers leave? It's simply not good business sense. Banks do it too - ever tried changing banks? All the things you'll need to update, the forms to fill out, the things you'll forget and need to update, it's going to take time and energy - and guess what? It's the same with software vendors. I know there's demand for this sort of thing out there. I've had a few emails from people looking for migration advice, and it's very hard to give at a generic level because it will vary depending on each persons individual situation as well as their level of knowledge in their source and destination platforms. However, I'm determined to complete this process for my data, and to make an honest attempt at documenting things along the way - hopefully that will come in the form of some articles in the future, or maybe even the odd application or two.

 Print | Posted on Wednesday, July 04, 2007 9:37 PM |



Feedback

Gravatar

# Subtle Lock in - liberating my data from Notes Databases

Ah.. Rich text. I've always had a slightly uneasy feeling about them, but it wasn't until I started to look at accessing Notes data via com that I realised what a pain in the ass they could be..

Have you considered building a .net app that gets the data from domino via com and then populates sql with it (after a bit of manipulation first) The only real benefit I can see with that is you can access the objects in rich text fields. Oh, and that you don't need to do it in notes so won't feel so ill after 15

7/5/2007 8:36 AM | Doug

Gravatar

# Subtle Lock in - liberating my data from Notes Databases

I did think about doing it that way, but decided it really wasn't going to make life much easier!

I think the best way to deal with RichText is to single out documents with attachments or embedded objects, and convert the rest to a text abstract. I really don't think I have enough time to devote to trying to cover all the other possible scenarios for RichText fields!

10 (time is money smiley)

7/5/2007 9:19 PM | Ross Hawkins


Post Comment

Title  
Name  
Email
Website / Url
 

Your comment

   
Ensure the word in this box says 'orange':
 
Please add 5 and 8 and type the answer here:





Due to excessive comment spam, all comments are now being moderated. If you're a comment spammer then you're wasting your time here. Your comments will not be published - ever.


About me

My name is Ross Hawkins and I'm a developer, consultant, business owner and writer based in Auckland, New Zealand (pictured below!). My current work revolves around ASP.NET, C#, jQuery, Ajax, SQL Server, and a mix of other Microsoft development technologies.

I also have about 15 years of experience with IBM Lotus Notes/Domino and associated technologies. While Notes/Domino is no longer my primary focus I still like to dabble and keep my skills up to date.

I own and run 2 businesses - Hawkins Consulting Services, and Ignition Development.

Bethells Beach, located in sunny West Auckland, New Zealand




Subscribe

Subscribe to this feed


Search




Popular Content

Troubleshooting WebResource.axd

The .NET 2.0 framework changed the way clientside JavaScript is delivered to the browser. Previously, ASP.NET 1.1 used the aspnet_client directory whereas now 2.0 uses WebResource.axd.

Published on October 8, 2006

Microsoft AJAX Extensions: Sys.Debug is null or not an object

One of the breaking changes which was made with the 1.0 release of the Microsoft Ajax Extensions was the renaming of the 'Debug' class to 'Sys.Debug' for reasons of compatiability with other frameworks. Breaking changes like this can often be a source of frustration..

Published on May 22, 2007

Simple ASP.NET Character Counter

A textbox character counter is a pretty simple piece of functionality, and there's a lot of different ways to apply one to your application. The following method is nice and simple, and can be done using only clientside JavaScript if required, or combined with server side code in order to create a more dynamic effect

Published on December 4, 2006

Simple ASP.NET Character Counter - with Master Page Support

A quick update to my previous character counter article adding some changes for those using it with Master Pages.

Published on February 7th, 2009

Adding Tooltips to Gridview Headers

As the title says, this is a very simple but dynamic way of achieving tooltip text on a header column. It's not overly flash, but it's lightweight and quick to implement.

Published on April 15, 2007

SQL Server Web Report Viewer Issues on Windows 2008 Server/IIS7

A fix for another AXD related issue, this time with the SQL Server Web Report Viewer Control which was being served up via IIS7 on a Windows 2008 server.

Published on June 2, 2007
Updated on April 10, 2008




Archives

January, 2012 (3)
December, 2011 (3)
November, 2011 (8)
October, 2011 (9)
September, 2011 (8)
August, 2011 (5)
July, 2011 (4)
June, 2011 (7)
May, 2011 (5)
April, 2011 (3)
March, 2011 (8)
February, 2011 (4)
January, 2011 (3)
December, 2010 (8)
November, 2010 (5)
October, 2010 (6)
September, 2010 (7)
August, 2010 (11)
July, 2010 (12)
June, 2010 (8)
May, 2010 (8)
April, 2010 (4)
March, 2010 (8)
February, 2010 (6)
January, 2010 (12)
December, 2009 (13)
November, 2009 (11)
October, 2009 (12)
September, 2009 (12)
August, 2009 (2)
July, 2009 (7)
June, 2009 (12)
May, 2009 (9)
April, 2009 (9)
March, 2009 (9)
February, 2009 (8)
January, 2009 (7)
December, 2008 (6)
November, 2008 (7)
October, 2008 (9)
September, 2008 (12)
August, 2008 (9)
July, 2008 (6)
June, 2008 (24)
May, 2008 (13)
April, 2008 (16)
March, 2008 (8)
February, 2008 (10)
January, 2008 (1)
December, 2007 (14)
November, 2007 (11)
October, 2007 (11)
September, 2007 (13)
August, 2007 (11)
July, 2007 (5)
June, 2007 (15)
May, 2007 (11)
April, 2007 (9)
March, 2007 (9)
February, 2007 (10)
January, 2007 (8)
December, 2006 (18)
November, 2006 (11)
October, 2006 (14)
September, 2006 (9)
August, 2006 (10)
July, 2006 (4)
June, 2006 (4)
May, 2006 (6)
April, 2006 (3)
February, 2006 (6)
January, 2006 (10)
September, 2005 (2)
August, 2005 (4)

Post Categories

ASP.NET
AJAX
Amusing
NZ
NZ Trains
Notes/Domino
Visual Studio
Web Development
Miscellaneous
Me
Rugby
C#
SQL