从lotus notes数据库中获取表名 [英] Get table names from lotus notes database

查看:206
本文介绍了从lotus notes数据库中获取表名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个程序,通过NotesSQL驱动程序将整个Lotus Notes数据库转储到文件中。我通过jdbc连接:odbc并且

I'm trying to write a program that would dump a whole lotus notes database to a file via NotesSQL driver. I'm connecting via jdbc:odbc and have

我可以执行选择并从Lotus Notes数据库中获取数据

I can execute selects and get data from Lotus notes database

这里是代码

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);
}

还有更好的方法通过NotesSQL连接Lotus Notes数据库吗?因为我的代码只获得 null 名称的值...

And is there a better way to connect to Lotus notes databases via NotesSQL? Because with my code i get only null values for the names...

推荐答案

我知道您正在尝试使用JDBC和NotesSQL。但是,根据您的需求和使用Eclipse,您可以通过Java本地访问Notes数据库,这比使用JDBC时更容易,当您在使用JDBC与Domino时,在圆孔中使用方块。即使您没有在主机上安装Lotus Notes,您仍然可以编写和部署Java applet和servlet以获取数据。

I know you are trying to use JDBC and NotesSQL. But, depending on your needs, and using Eclipse, you can access Notes databases natively via Java, which frankly is alot easier than trying to use JDBC, bit of a square peg in a round hole when you're using JDBC with Domino. Even if you don't have Lotus Notes installed on the host machine you can still write and deploy java applets and servlets to get into the data.

你需要获得相关的Lotus Domino jar。因此,我的建议是JDBC的替代方法。

You will need to get the relevant Lotus Domino jar's though. So, my recommendation is an alternative approach to JDBC.

因此,如果您在Eclipse项目中拥有Lotus Domino jar文件,那么您应该能够编写任何类型的提取从视图或甚至在数据库上运行adhoc搜索。

So, providing you have the Lotus Domino jar files in your Eclipse project you should be able to code any kind of extract from a view or even run adhoc searches on a database.

设置

如果这听起来像你需要的方向,那么首先,看一下用相关的Notes jar设置Eclipse 这里。只有少数。 (有时候你会读到关于使用CORBA和/或IIOP的内容。试着避免使用它,这只是一个受伤的世界。)

If this sounds like the direction you need to go, then firstly, have a look at setting up Eclipse with relevant Notes jar's here. There are only a few. (Sometimes you'll read about using CORBA and/or IIOP. Try avoid that, it's just a world of hurt).

样本和片段

开发人员的作品(尽管已有6年历史)仍然适用于Domino,并且是我所倡导的方法的坚实基础。那篇文章开始讨论NotesFactory和Session类的初始化,以引导您进入Notes API。更多在线帮助此处了解NotesFactory类。

This developer works article (although 6 years old) still works for Domino and is a sound foundation for the approach I am advocating. That article starts to address the initialization of the NotesFactory and Session classes to get you into the Notes API. More online help here for the NotesFactory class.

如果你有一个可用的Lotus Notes客户端,你可以查看代码片段此处。可以在此处。

If you have a Lotus Notes client available you can have a look through code snippets here. A classic example for accessing documents via Views in Java can be found here.

之后,您可以使用这里,并向大师(Bob Balaban)学习内存管理 here

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

如果你正在处理高容量或运行servlet,那么内存管理很重要,否则不要过分强调它。您可以在Notes数据库中执行本机搜索,方法是在公式中编写,然后使用搜索本地执行查询的方法。

If you're processing high volumes or running servlets, then memory management is important, otherwise don't stress about it too much. You can execute Native searches on a Notes database by writing it in formula, and then using the "search" methods to execute the query natively.

迭代文档或视图?

最简单的方法是遍历文档通过视图和/或使用 getdocumentByKey 获取集合并进行处理的方法。在Domino中,视图等同于表。您还可以通过 Database.Views 属性

The easiest approach is to traverse documents via views and/or use "getdocumentByKey" methods to get a collection and work on that. In Domino "Views" are the equivalent of Tables. You can also get a list of Views via the Database.Views property

原生查询

很难找到有关Notes本机查询的明确指示,但我已设法在线找到它这里

It's difficult to find definitive instructions on native queries for Notes, but I have managed to find it online here.

这篇关于从lotus notes数据库中获取表名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆