Skip to main content
This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks

  

PreviousPrevious NextNext


Michael Zens 19.Mar.08 05:28 PM a Web browser
Notes Client 7.0.2; 6.0.3 Windows XP


We have a DB with replica's on 3 servers. We want to force people to use Server A so I wrote some Database Script in the PostOpen event. Basically the script checks to see if the database the user is trying to open is the one on Server A. If so, then open it. If not then see if Server A DB can be opened and if it can then open the database on server A and close the database the user tried to access, let's say Server B. In this case, the script is running on Server B.

This works great if the Client is 6.0.3, when we try openning the db on ServerB it opens the DB on Server A and closes the db on server B.

When we try it on a 7.0.2 Client. It Starts to run the Script and the Status bar says "Script is busy" and then it crashes the Notes Client. If we try to open the DB on server A it opens with no problem, only when we try to open it on server B and it redirects it to server A.

The code was developed on 6.0.3 Designer
The servers are 6.0.2 CF1

Here is my code:

Dim thisServer As String
Dim thisDbPath As String
Dim prodServerAName As String
Dim prodServerBName As String
Dim drServerName As String

Sub Postopen(Source As Notesuidatabase)
'01/05/2007 (mdz) this script checks the current server and if it is "DR Server" then it will attempt to open the
'production database on "Server A". If open is successful then it redirects the user to the production replica
'and closes the source database and also removes the icon on the desktop for the offending database.
removeIcon = False 'this will flag to remove the Icon being used if set to true
Dim ws As New NotesUIWorkspace
Dim ses As New NotesSession
Dim uidb As NotesUIDatabase
Dim thisdb As NotesDatabase
Dim prodDBA As New NotesDatabase ("","")
Dim prodDBB As New NotesDatabase ("","")
Dim configDoc As NotesDocument
Dim nam As NotesName
Dim repID As String, msgTitle As String, message As String

'setup Notes Stuff
Set uidb = source
Set thisdb = uidb.Database
Set nam = ses.CreateName(thisDB.Server)
Set configDoc = thisDb.GetProfileDocument("Systemdoc")
'get replica of Db and try to open the Production Database
repID = thisDb.ReplicaID 'used to find replica on production server
thisServer = nam.Abbreviated
thisDbPath = thisDB.filePath
'get the names of the servers from the system document
prodServerA = configDoc.GetItemValue("prodServerA") 'first production copy
prodServerAName = prodServerA(0)
prodServerB = configDoc.GetItemValue("prodServerB") 'second Production Server
prodServerBName = prodServerB(0)
DRServer = configDoc.GetItemValue("drServer") 'disaster recovery server
drServerName = DRServer(0)

If thisServer = prodServerAName Then Exit Sub 'it is the production server so allow access

If thisServer = prodServerBName Then 'it is on the 1st backup server
'check availablity of production database on production server
If ProdDbA.OpenbyReplicaID(prodServerAName,repID) Then 'production is up and running
Call uidb.Close 'close the original database used
Call ws.OpenDatabase(ProdDbA.Server,ProdDbA.filePath,"(All Docs)") 'open the production database
Set thisDB = Nothing
Set ProdDb = Nothing
Exit Sub 'done with script
Else
Exit Sub 'allow access to the current database
End If
End If

If thisServer = drServerName Then 'then it is on the disaster recovery server
'try to open production db based on source db replica id, then try 1st backup server after that.
'If both are down then allow access to DR Db.
If ProdDbA.OpenbyReplicaID(prodServerAName,repID) Then 'production is up and running
removeIcon = True

Call uidb.Close 'close the original database used
Call ws.OpenDatabase(ProdDbA.Server,ProdDbA.filePath,"(All Docs)") 'open the production database
Set thisDB = Nothing
Set ProdDbA = Nothing
Set ProdDbB = Nothing
Exit Sub 'done with script
Elseif ProdDbB.OpenbyReplicaID(prodServerB(0),repID) Then 'production server down - check for 1st back up server
removeIcon = True
Call uidb.Close 'close the original database used
Call ws.OpenDatabase(ProdDbBB.Server,ProdDbB.filePath,"(All Docs)") 'open the 1st backup database
Set thisDB = Nothing
Set ProdDbA = Nothing
Set ProdDbB = Nothing
Exit Sub 'done with script
Else
'looks like both Server A and Server B are down - open the DR server replica
End If
End If
Goto EndofCode
EndOfCode:

End Sub

- Mike






Database AScript - PostOpen event I... (Michael Zens 19.Mar.08)
. . RE: Database AScript - PostOpen eve... (Michael Zens 20.Mar.08)





  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

Resources

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds

Wikis

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums


 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite