user3846091
user3846091

Reputation: 1703

How to export data from a IBM Lotus Notes Database using Java

I want to export data from a Lotus Notes database .nsf that lives on my local computer. I want to write a java program that will connect to this .nsf lotus notes database and export data from a view/form.

I am not sure how to do that ? Is there a sample code that i can refer too or a JDBC-ODBC driver ?

Upvotes: 1

Views: 3698

Answers (3)

Ove Stoerholt
Ove Stoerholt

Reputation: 3974

I recommend trying IBM Security Directory Integrator (former Tivoli Directory Integrator, or TDI). It's a integration tool especially built for your purpose.

SDI operates using so-called assembly lines where you have one or more sources and one or more destinations. In between you can manipulate your data to your hearts desire.

Some versions of TDI/SDI are free with the newest versions of IBM Domino. Check out these sites for more info:

Good luck! Ove

Upvotes: 0

Karl-Henry Martinsson
Karl-Henry Martinsson

Reputation: 2795

You actually have two issues/questions. 1) How to use Java to connect to a Notes database 2) How to export data from documents (let's use the correct terminology, form is a design element, data is stored in documents)

For 1) there is plenty of sample code available, like the link poisonedYouth referenced in his response.

For 2) I would suggest looking at the samples in the Domino Designer help. You need to undertand that Domino Object Model (DOM) first, and know how that data is stored.

But you would probably do something like this:

  • Create a new NotesSession object
  • Get a NotesDatabase object from the session
  • Get a NotesView object from the database

Now you can do it different ways, depending on éxactly what you want to do and things like what items are being displayed in the view.

If all fields you want to export are displayed in the view, I would do this:

  • Get a NotesViewEntryCollection document from the view
  • Use GetFirstEntry and GetNextEntry methods to loop through the collection and get the individual entries
  • Use the ColumnValues property of the NotesViewEntry object to get the values displayed in the view, then export those values the way you want it.

If you don't have all the values displayed in the view, use this (slower) method:

  • Use the GetFirstDocument and GetNextDocument methods to loop through all NotesDocuments in the view
  • For each document, read the field values using GetItemValues (remember that all field values are returned as an array, even if they only contain one value) and export them the way you like.

Exporting data from Notes is a very common process, and you should be able to find plenty of code. I have a tool available(it is not open source, though) here: http://www.texasswede.com/websites/texasswede.nsf/Page/Notes%20XML%20Exporter

I also posted code on my blog that you can look at and modify: http://blog.texasswede.com/export-notes-view-to-excel-with-multi-value-fields/

Upvotes: 4

PoisonedYouth
PoisonedYouth

Reputation: 548

I found an article with topic "Writing standalone Java code that connects to IBM Lotus Domino"

http://www-10.lotus.com/ldd/dominowiki.nsf/dx/06082009125716AMWEB7TU.htm

Upvotes: 0

Related Questions