Skip to main content

How to get Domino database from on disk project to server in a batch file

Originally posted in Sutol Connections

Martin Jinoch wrote an article about parameters required for headless designer
I did some experiments how to get the db to a server. Here are first thoughts. I'Il probably write more later.
 
I had to create 2 components:

1. Batch file to run it
2. NSF db that does notes operations


1. In batch file biggest issue was to find when the job is done, since it creates separate processes. Google offered some advices, so I ended up using pslist from pstools and sleep command found somewhere else.

Here is the file
designer.exe -RPARAMS -console -vmargs -Dcom.ibm.designer.cmd="true,true,trtest.nsf,importandbuild,C:\Git\Teamroom\TR\.project,trtest.nsf"

@echo off
:LOOP
C:\pstools\PSLIST notes2 >nul 2>&1
IF ERRORLEVEL 1 (
  GOTO CONTINUE
) ELSE (
  ECHO designer is still running
  C:\sleep\SLEEP 5 /quiet
  GOTO LOOP
)

:CONTINUE

echo "launch client to copy"

nlnotes.exe notes:///cideploy.nsf/84AD4CF25D638F66C1257C77006547DA/53D2901644D70EDFC1257C77006588AA?OpenDocument

echo "open"

explorer http://mytestserver/servertr.nsf

2. Local db that has configuration profile for the app. it is called using notes:// link (and calling it with nlnotes has nice sideeffect that it waits to complete). Biggest issue was to automatically closed notes when done.

Link actually opens document using form that has queryopen event to do the job and postopen with @Command([ExitNotes]) . It has to be called using viewunid and unid of the document, since I use form formula of the view to redirect it to form that does the job, instead of standard form that I use for configuration.

Code can be than pretty much anything I have for now just:
    Dim doc As NotesDocument
    Set doc=source.document
  
  
    Dim sourcedb As New NotesDatabase("",doc.profilekey(0))
    If sourcedb.IsOpen Then
      
        Dim targetdb As New NotesDatabase(doc.targetserver(0),doc.targetnsf(0))
      
        If targetdb.IsOpen Then
            Call targetdb.Remove
        End If
      
        Call sourcedb.CreateCopy(doc.targetserver(0),doc.targetnsf(0))
      
    End If
  
And that's all. I tested it with teamroom db and it worked fine.

Comments

Popular posts from this blog

Microsoft Word black box in numbering issue

This is awkward post, primarily to save the solution for future me. I have seen many people mentioning this problem over years and as I've struggled with it several times, I needed to find final and permanent solution. All editions of Microsoft Word from time to time suffer from bug in numbering. Instead of a number, black box is displayed. Sometimes it happens right after document is opened, sometimes during editing. Probably some internal structure of document gets corrupted, so based on level of corruption, different fixes could help. Many of them are listed at  https://answers.microsoft.com/en-us/office/forum/office_2010-word/ms-word-header-styles-are-showing-black-boxes/c427b21c-dcda-46ce-a506-b9a16c9f2f3f I took different approach. Since docx is just standard zip package with xml files, I decided to try if I can fix it manually. And it worked. When I extracted the docx, there was file called numbering.xml in word folder. When I examined that file, I found strange se

WSL, HCL Volt and some Docker

My list of new technologies to try was growing fast in past months, but now I finally can try to catch up with all the cool improvements that can be used to enhance my/your dev experience. Microsoft has enhanced the Windows Subsystem for Linux this year and Docker completely changed the way Docker Desktop for Windows is integrated into the operating system. The most important change for me was that I can finally run Docker Desktop and VMWare Workstation on my machine in parallel. When I was looking for some good use cases to try how it works, HCL Domino was a logical choice. HCL started to even publish official Docker images for every release and some pre-releases are only available as Docker images. I have many test Domino machines running in VMs, but I had no HCL Volt. If you don't know that HCL Volt is - it's a new low-code platform that brings HCL Form Builder experience, now know as HCL Leap, to HCL Domino, which then serves as a data store and application server. Whe

HCL Domino SSO with Microsoft Teams

 Microsoft Teams is probably one of the most used tools this year, it was already quite popular before the pandemic started to spread across the world this spring, but now most of the businesses I work with use it. After using it just like a chat/conferencing tool, many start to explore further capabilities of the platform. When working with Domino data in apps that are web-enabled, it can be quite easy - just add a web tab anywhere you want. The problem is, that you need to deal with user authentication.