Topic
  • 2 replies
  • Latest Post - ‏2004-06-16T15:11:45Z by SystemAdmin
SystemAdmin
SystemAdmin
37422 Posts

Pinned topic Accessing Lotus Notes database from a servlet.

‏2004-06-15T16:35:12Z |
Hi all,

How can Lotus Notes databases be accessed from a servlet or JavaBean? Any help will be highly appreciated.

Thanks in advance...

Gauzy
Updated on 2004-06-16T15:11:45Z at 2004-06-16T15:11:45Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    37422 Posts

    Re: Accessing Lotus Notes database from a servlet.

    ‏2004-06-16T09:30:13Z  
    This requires the nsco.jar file (found in the data/domino/java directory
    of the client).

    and then :

    package com.hpigmbh.fleetReporting.presentation.actions;

    import java.io.IOException;

    import javax.servlet.Servlet;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import lotus.domino.Database;
    import lotus.domino.Document;
    import lotus.domino.DocumentCollection;
    import lotus.domino.NotesException;
    import lotus.domino.NotesFactory;
    import lotus.domino.NotesThread;
    import lotus.domino.Session;

    public class notesTest extends HttpServlet implements Servlet {

    public void doGet(HttpServletRequest req, HttpServletResponse
    resp) throws ServletException, IOException {

    try {
    NotesThread.sinitThread();
    Session notesSession = NotesFactory.createSession(
    "hostString", "userString", "passwordString");
    Database notesDatabase = notesSession.getDatabase(
    "MyServer", "MyDatabase.NSF");
    DocumentCollection notesCollection =
    notesDatabase.getAllDocuments();
    Document notesDocument =
    notesCollection.getFirstDocument();
    // And so on
    }
    catch (NotesException e) {
    e.printStackTrace();
    }
    finally {
    NotesThread.stermThread();
    }

    }

    public void doPost(HttpServletRequest req, HttpServletResponse
    resp) throws ServletException, IOException {

    }

    }
    if you're into notes development, the rest is easy as known from notes
    script

  • SystemAdmin
    SystemAdmin
    37422 Posts

    Re: Accessing Lotus Notes database from a servlet.

    ‏2004-06-16T15:11:45Z  
    This requires the nsco.jar file (found in the data/domino/java directory
    of the client).

    and then :

    package com.hpigmbh.fleetReporting.presentation.actions;

    import java.io.IOException;

    import javax.servlet.Servlet;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import lotus.domino.Database;
    import lotus.domino.Document;
    import lotus.domino.DocumentCollection;
    import lotus.domino.NotesException;
    import lotus.domino.NotesFactory;
    import lotus.domino.NotesThread;
    import lotus.domino.Session;

    public class notesTest extends HttpServlet implements Servlet {

    public void doGet(HttpServletRequest req, HttpServletResponse
    resp) throws ServletException, IOException {

    try {
    NotesThread.sinitThread();
    Session notesSession = NotesFactory.createSession(
    "hostString", "userString", "passwordString");
    Database notesDatabase = notesSession.getDatabase(
    "MyServer", "MyDatabase.NSF");
    DocumentCollection notesCollection =
    notesDatabase.getAllDocuments();
    Document notesDocument =
    notesCollection.getFirstDocument();
    // And so on
    }
    catch (NotesException e) {
    e.printStackTrace();
    }
    finally {
    NotesThread.stermThread();
    }

    }

    public void doPost(HttpServletRequest req, HttpServletResponse
    resp) throws ServletException, IOException {

    }

    }
    if you're into notes development, the rest is easy as known from notes
    script

    Thanks Matthias for posting your example. That will surely help me to start with. I will try it and let you know if I am stuck :)

    Thanks again.

    Gauzy