Lotus Domino and relational database (LEI,DESC,JDBC connection) __ Database

Source: Internet
Author: User
Tags db2 odbc stmt

Domino and relational database interaction is a common aspect of day-to-day project development that every Domino developer has written, and this article makes a simple summary of this.
One, the tool article
1. Use Lei (Lotus Enterprise Integrator)
Lei's English full name is Lotus Enterprise Integrator, a previously known notespump upgrade, a server-based data distribution product that provides an environment for defining and managing the following things:
* A large number of data exchange
* Data Synchronization
: Event-driven and real-time data transfer
The LEI server processes instructions, establishes a connection to an external data source, and transmits the data according to the conditions of the defined activity. It requires a Domino 4.6x or 5.x version of the server that can be run separately or as an internal server task.
Lotus Enterprise Integrator (LEI) 6.x can move attachments from the Domino database to the RDBMS table, so that these attachments can be read from within the RDBMS. More importantly, this action can be done quickly without writing any scripting code. In this regard, the IBM official website has detailed steps on this operation, interested peers can read, Links: http://www.ibm.com/developerwork ... achments/index.html
2, DESC (Domino Enterprise Connection Services)
DECs's English full name is Domino Enterprise Connection Services, a subset of Lei, which is just a live notes activity. DECs is a wizard-based server task that is included in the Domino 4.6.3 and its later versions. It modifies the Notes.ini file to include Live extensions: Extmgr_addins=ndecsext.dll (for NT)
Here, introduce the usage of decs, this article will be a very simple example for everyone to explain the use of the process, more complex use, we can do more in-depth research. Let's use Notes to import an Access database as an example (the database is registered in ODBC)
Preparatory work:
Make sure you have the Notes database you want to import.
Guaranteed access to a database
Ensure that ODBC has joined the Access database data source.
First step:
If you are using DECs for the first time, Please check your server's data directory to see if there is a DECSADM.NSF database, if not the database, to the Domino's own template named decsadm.ntf to establish the database, the relevant settings for DECs will be in this database.
Step Two:
Enter the load DECS on the console of the server.
Step Three:
When the task starts, open the DECSADM.NSF database on the server.
Fourth Step:
Click ' Create Connection ' to make a connection. Select the type of database you want to create (Db2,or I
ACLE,ODBC). This example selects ODBC.
Fifth Step:
After opening the connection form:
The following items are in the form:
Data Source: Enter the DataSource.
In this example, enter the name of the data source you want to connect to in ODBC.
Username: Enter the name of the user who can access the data source.
Password: Enter the user password to access the data source Password encryption key: The user password that you entered after clicking, encrypted in notes.
Selection type: Is your choice of table or view
: Select the owner of the table.
Name: Select which table you want to connect to.
Save and exit after filling out.
Sixth step:
Click Create activity, creating an action. The system provides an Action wizard, click Create Activity, the system opens the form, and an Action wizard pops up, and if you're sure you use it, click OK.
Select which Notes database you want to import into.
Select which form you want to import into the database.
Select which "Connection" you use (the fourth step created)
Select which table and view you want to import into the external database.
This will come out of the key and data field mapping.
Key: Is your primary index.
Field: Are the fields that you want to correspond to separately.
Select the Notes field on the left and select the field for the external database on the right.
Select your actions for the external database open,create,update,delete
Enter the name you took for the import action. Then save to close the current document.
Seventh Step:
1. Check the "Activities" navigation to select which "action" you want to activate
Click ' Start ' to start the action.
If you do not succeed, click "Log", and if you want to stop the action, click "Stop"
Icon Description: The first icon indicates that the action is not active, the second icon indicates that the action is active, and the third icon indicates that the action is active.
Eighth Step:
1. Open the Notes database you want to import, and create the document with the form you just 2nd in step sixth.
Enter a data entry into the external database in the domain of your key. For example, if I take the ID field of a table in an Access database as a key and correspond to the test field in notes, then we should type in the test field: "10203"
Save the current document.
Nineth Step:
In the view, open the saved Notes document that you just created. We will find that the data that corresponds to the external database will appear in the other mapped domains. The data in the external database is then introduced into notes.
There is a certain difference between decs and Lei, which can be summarized as follows:
1 Lei provides a versatile set of data access tools that can be programmed, DECS limited to predefined features, 2 Lei handles large-scale data transfers, DECS works only at the document level, and 3 lei applies to two non-notes data sources. DECS requires notes as a data source.
3. Data interaction with DB2
Domino's and DB2 's data integration capabilities were provided at the time of release 7, but IBM was just trying to do it without technical support for this feature and other related services, with the release of Domino8, IBM Official Statement Domino8 has supported this feature, personal feeling, here rather than with DB2 data interaction, rather than call and DB2 data sharing. With the relevant help documentation provided by IBM, the correct configuration will enable you to migrate all Domino data into DB2 so that there is only one shell in the Domino database, all the real data is in the DB2, I looked it up, and after this configuration, Domino's database is only a few 10 bytes, but for users, there is no change, this function is very powerful, but unfortunately only support the DB2 relational database, after all, the database is also their own things, perhaps in the near future will support other popular relational database, look forward to ING. For this aspect of use, we carefully refer to help to do so, here is not to say more.
Second, the procedure article
1. Use ODBC
With the prerequisites for this solution, the following two conditions must have one:
A, the program is running on the client, namely: CS mode, and the client operating system is the window series;
b, the program is running on the server, and the server operating system is the Windows family;
This solution is mainly the use of Domino provided three classes: OdbcConnection, Odbcquery, Odbcresultset, there is no such examples on hand, so do not provide, if some brothers, please send up, I edited into this article, thanks in advance. We can also refer to designer's help to find some enlightenment.
2. Use JDBC
In general, it is not recommended to use Java in Domino programming, which is well known, Lotus's support for Java is not flattering, but if subject to objective conditions, only JDBC, then there is no way, such as our company, BS structure, the server operating system is Solaris , the use of tools will certainly not be considered, and do not have the use of ODBC conditions, can only spot, but generally, if the program is more robust, for some Java objects to do a reasonable release, in the short term should not appear what problems. To the point, use the steps:
A, find Oracle's JDBC driver package: Class12.jar;
b, or you can introduce the jar package directly at the design end after establishing the agent, or upload the jar package to the server, modify the Notes.ini file, and add the javaclasses parameter for introduction;
C, the following gives a small piece of code, this is believed that everyone is very familiar with, not to say more, but a mouth, if you confirm all the steps are correct, the Java agent is still not running correctly, you can try to set the security restrictions of the agent to: Allow restricted operation.
Import lotus.domino.*;
Import java.sql.*;
public class Javaagent extends Agentbase {
public void Notesmain () {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null
try {
Session session = GetSession ();
Agentcontext Agentcontext = Session.getagentcontext ();
Class.forName ("Oracle.jdbc.driver.OracleDriver");
String url = "jdbc Racle:thinip address: 1521 ROD";
String user = "* * *";
String Password = "* * *";
conn = Java.sql.DriverManager.getConnection (Url,user,password);
stmt = Conn.createstatement ();
String sql = "SELECT * from Ra_salesreps_all";
rs = stmt.executequery (SQL);
while (Rs.next ()) {
System.out.println (rs.getstring ("name")); }
catch (Exception e) {
{E.printstacktrace ();
}finally{
try{
Rs.close ();
Stmt.close ();
Conn.close ();
}catch (SQLException Sqle) {
System.out.println (Sqle);
}
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.