|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)
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
//Session session = NotesFactory.createSession((String)null);//Same result as first one [NotesFactory.createSession()]
//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
//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:
//Following line throws exception 'Database has not been opened yet'
View vwDemo = dbDemo.getView("vwDemo");
//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'
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
Feedback number WEBBB64APZ created by Romil Handoo on 10/22/2019