Skip to main content
REMINDER: On December 1, 2018, this forum will be closed to new posts and responses. After that date, you will still be able to view and search the forum. New discussions should take 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  >  IBM Lotus Notes/Domino 8.5 Forum (includes Lotus Notes Traveler)

IBM Lotus Notes/Domino 8.5 Forum (includes Lotus Notes Traveler)

Sign in to participate Previous Next
Subject: Java to Lotus Notes connection issue
Feedback Type: Problem
Product Area: Domino Server
Technical Area: Accessibility
Platform: ALL
Release: 8.5.3
Reproducible: Always

I am trying to access the data from Lotus Notes database into an external Java program, but no luck.

On my laptop, I have configured IBM Domino 9.0.1 server, where I have created a demo database. My target is, to access the data from this database through external Java code. I have also installed Netbeans and Eclipse on the same laptop where Domino server is configured. Now, I am trying to access the demo lotus notes database in my java program (netbeans/eclipse) using the classes provided in Notes.jar package, but unable to open database.

To accomplish the task, I have followed below steps:

Added the path 'C:\Program Files\IBM\Domino' to 'Path' system variable, and rebooted the laptop.
In Netbeans (also tried in Eclipse), created Java class (console application), added Notes.jar file (IBM/Domino/JVM/lib/ext/Notes.jar) in the classpath (in netbeans, added Notes.jar in Resources section. In Eclipse, copied Notes.jar in lib folder).
Added the following code in the class: (assume lotus.domino.* is already imported in the code)



public static void main(String [] args)
{
try{
NotesThread.sInitThread();
//Case1
Session session = NotesFactory.createSession()//Connect the server with server ID. Throws error 'Database has not been opened yet';
//Also tried following options. Note that I have assigned full access/manager rights to anonymous user on the demo database
//Case2
//Session session = NotesFactory.createSession((String)null);//Same result as first one [NotesFactory.createSession()]
//Case3
//Session session = NotesFactory.createSession((String)null,"Romil Handoo/dev","My_Domino_Internet_Password");//Connect the server as Romil Handoo/dev login. Throws error- Invalid User Id/Password. I am giving correct ID/password
//Case4
//Session session = NotesFactory.createSession((String)null,"","");//Access with anonymous user. Throws error 'Database has not been opened yet'**
Database dbDemo = session.getDatabase(session.getServer(), "demo/DemoDB.nsf");
//session.getServer() is returning my server name, which is Development/home.
//Also tried these, but same result each time:
//session.getDatabase("localhost:9595","demo/DemoDB.nsf")
//session.getDatabase("localhost","demo/DemoDB.nsf")
//session.getDatabase("127.0.0.1:9595","demo/DemoDB.nsf")
//session.getDatabase("127.0.0.1","demo/DemoDB.nsf")
//session.getDatabase("","demo/DemoDB.nsf")
//session.getDatabase((String)null,"demo/DemoDB.nsf")
//Following line throws exception 'Database has not been opened yet'
View vwDemo = dbDemo.getView("vwDemo");
}
catch(Exception ex)
{
System.out.println(ex.toString());
//For case 1, case 2, and case 4, error message is 'Database has not been opened yet'
//For case 3, error message is 'Invalid login id/password'

}
finally
{
NotesThread.stermThread();
}
}




Please someone guide me how I may connect to domino database through external java code? For all these steps, I have referred the page https://www.ibm.com/support/knowledgecenter/en/SSVRGU_9.0.1/basic/H_NOTESDATABASE_CLASS_JAVA.html

Many thanks


Feedback number WEBBB64APZ created by Romil Handoo on 11/01/2018

Status: Open
Comments:





Printer-friendly

Search this forum


Sign In or Register

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

Member Tools


RSS Feeds

 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