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/