Get table names from the lotus notes database

I am trying to write a program that dumps the entire lotus notes database to a file through the NotesSQL driver. I connect via jdbc: odbc and

I can make a selection and retrieve data from the Lotus Notes database

here is the code

try { System.out.print("Connecting... "); Connection con = DriverManager.getConnection("jdbc:odbc:NRC", "UserName", "Passw0rd1337"); System.out.println("OK"); DatabaseMetaData dmd = con.getMetaData(); String[] tableTypes = new String[] {"TABLE", "VIEW"}; ResultSet rs = dmd.getTables(null, null, "%", tableTypes); ResultSetMetaData rsd = rs.getMetaData(); while (rs.next()) { for (int i=1; i<=rsd.getColumnCount();i++) System.out.println(i+" - "+rsd.getColumnName(i) + " - " + rs.getString(1)); } con.close(); System.out.println("Connection closed"); } catch (Exception e) { System.out.println(e); } 

And is there a better way to connect to Lotus Notes databases through NotesSQL? Because with my code, I only get null values ​​for names ...

+4
source share
1 answer

I know that you are trying to use JDBC and NotesSQL. But, depending on your needs and the use of Eclipse, you can directly access Notes databases through Java, which, frankly, is much easier than trying to use JDBC, the square-bind bit in the round hole when you use JDBC with Domino. Even if you do not have Lotus Notes installed on the host machine, you can still write and deploy Java applets and servlets to access data.

However, you need to get the appropriate Lotus Domino banner. So my recommendation is an alternative approach to JDBC.

So, if you have Lotus Domino jar files in an Eclipse project, you should be able to encode any view from the view or even run adhoc search in the database.

Customization

If this seems like the direction you need to go, first try setting up Eclipse with the appropriate jar note here . There are only a few. (Sometimes you will read about using CORBA and / or IIOP. Try to avoid this, it's just a world of pain).

Samples and fragments

This developer article (though 6 years old) still works on Domino and is a good foundation for the approach that I support. In this article, we'll look at initializing the NotesFactory and Session classes to access the Notes API. Additional online help is here for the NotesFactory class.

If you have a Lotus Notes client, you can view the code snippets here . A classic example of accessing documents through views in Java can be found here .

After that, you can easily access the views and documents with examples from here and find out from the guru (Bob Balaban) about memory management here .

If you are processing large volumes or running servlets, it is important to keep memory management in mind, otherwise it is not too important. You can perform your own searches in the Notes database by writing them in the formula, and then using the search methods to execute the query initially.

Iterate through documents or views?

The easiest way is to crawl documents through views and / or use the getdocumentByKey methods to get the collection and work on it. In Domino, "Views" are equivalent to tables. You can also get a list of views through the Database.Views property

Inline Queries

It's hard to find the final native query instructions for Notes, but I managed to find it online here .

+7
source

Source: https://habr.com/ru/post/1346078/


All Articles