文件名称:domino访问关系性数据库例子
文件大小:6KB
文件格式:JAVA
更新时间:2014-10-17 07:36:57
domino访问关系性数据库例子
import lotus.domino.*;
import java.sql.*;
import java.io.*;
public class JavaAgent extends AgentBase {
private static Connection conn = null;
private static String aJdbcStr;
private static String aUsername;
private static String aPassword;
private static String aDrv;
public void NotesMain() {
Session session = null;
AgentContext agentContext = null;
Document docContext = null;
Document cdoc = null;
String strSQL = null;
String strname = null;
String strgeneral = null;
String strbir_year = null;
String strbir_month = null;
String strbir_day = null;
Connection conn = null;
Statement stmt = null;
Statement stmt2 = null;
Statement stmt3 = null;
String sql = null;
InputStream inStream = null;
int iUpdate = 0;
ResultSet rs = null;
ResultSet rs3 = null;
String srcFile = null;
InputStream inps = null;
byte[] bytes = null;
/**
*
方法说明:获得数据连接
*
输入参数:
*
返回类型:Connection 连接对象
*/
try {
session = getSession();
agentContext = session.getAgentContext();
docContext = agentContext.getDocumentContext();
Database cdb = agentContext.getCurrentDatabase();
Agent agent = agentContext.getCurrentAgent();
cdoc = cdb.getDocumentByID(agent.getParameterDocID());
Document prodoc = cdb.getProfileDocument("Form_Profile", "");
aDrv = prodoc.getItemValueString("pro_Driver"); // 数据库驱动
aJdbcStr = prodoc.getItemValueString("pro_JdbcStr"); // 数据库连接字符串
aUsername = prodoc.getItemValueString("pro_Username"); // 数据库用户名
aPassword = prodoc.getItemValueString("pro_Password"); // 数据库密码