domino采用JDBC与关系数据库集成

本文介绍如何使用Domino文档型数据库通过JDBC与Oracle关系数据库集成,实现流程效率统计及监控,包括配置步骤和Java脚本示例。

domino采用JDBC与关系数据库集成

  439人阅读  评论(0)  收藏  举报
  分类:

       domino是文档型数据库,相比关系数据库在权限控制方便有一定的优势,但是在数据分析、统计方面在关系数据库面前则是它的瓶颈。故在实施数据分析、统计方面的应用与关系数据库集成则成为了必然。

       本文的项目背景是实现流程效率统计,通过此应用来监控流程各个环节的办理情况,超过办理时限的环节通过绩效扣分的方式来进行管控,达到有效提高流程的办理效率。

       流程审批平台:domino

       数据存储:Oracle

       数据分析、统计:tomcat+servlet

       这里主要讲domino怎样往oracle进行增、删、改动作。

【jar包】

       ojdbc14.jar (网上很多,找起来也方便,部署在\jvm\lib\ext目录下,要重启domino)

Java脚本库】

[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. import java.sql.Connection;  
  2. import java.sql.DriverManager;  
  3. import java.sql.ResultSet;  
  4. import java.sql.Statement;  
  5.   
  6. public class HurrylogClass {   
  7.       
  8.     Connection conn = null;  
  9.     Statement stmt = null;  
  10.     ResultSet rset = null;  
  11.       
  12.     String sDriver = "";  
  13.     String sURL = "";  
  14.     String sName = "";  
  15.     String sPasswd = "";  
  16.       
  17.     /* 
  18.      * 构造函数 
  19.      */  
  20.     public HurrylogClass() throws Exception{  
  21.           
  22.     }  
  23.       
  24.     public void fnSetSDriver(String sDriver){  
  25.         this.sDriver = sDriver;  
  26.     }  
  27.       
  28.     public void fnSetSURL(String sURL){  
  29.         this.sURL = sURL;  
  30.     }  
  31.       
  32.     public void fnSetSName(String sName){  
  33.         this.sName = sName;  
  34.     }  
  35.       
  36.     public void fnSetSPasswd(String sPasswd){  
  37.         this.sPasswd = sPasswd;  
  38.     }  
  39.       
  40.     /* 
  41.      * @初始化 
  42.      */  
  43.     public void fnInit() throws Exception{  
  44.         try{  
  45.             conn = fnInitConnetion();  
  46.         }catch(Exception e){  
  47.             e.printStackTrace();  
  48.         }  
  49.     }  
  50.     /* 
  51.      * @创建与Oracle数据库连接  
  52.      */  
  53.     public Connection fnInitConnetion() throws Exception{  
  54. //      Connection conn = null;  
  55.           
  56.         /*Class.forName("oracle.jdbc.driver.OracleDriver"); 
  57.         conn = DriverManager.getConnection( 
  58.                 "jdbc:oracle:thin:@10.3.255.175:1521:orcl", "hurrylog", 
  59.                 "hurrylog");*/  
  60.         Class.forName(this.sDriver);  
  61.         conn = DriverManager.getConnection(this.sURL, this.sName,this.sPasswd);  
  62.           
  63.         return conn;  
  64.     }  
  65.       
  66.     /* 
  67.      * @创建Statement对象 
  68.      */  
  69.     public Statement fnCreateStatement() throws Exception{  
  70.         try{  
  71. //          conn = fnInitConnetion();  
  72.             if(conn!=null && conn.isClosed()==false){  
  73.                 stmt = conn.createStatement();  
  74.             }  
  75.         }catch(Exception e){  
  76.             e.printStackTrace();  
  77.         }  
  78.         return stmt;  
  79.     }  
  80.     /* 
  81.      * @执行Oracle查询,返回查询结果 
  82.      */  
  83.     public ResultSet fnExcuteQuery(String sQuery) throws Exception{  
  84.           
  85.         try{  
  86. //          conn = fnInitConnetion();  
  87.             if(stmt!=null){  
  88. //              stmt = conn.createStatement();  
  89.                 rset = stmt.executeQuery(sQuery);  
  90.             }  
  91.         }catch(Exception e){  
  92.             e.printStackTrace();  
  93.         }  
  94.         return rset;  
  95.     }  
  96.       
  97.     /* 
  98.      * @执行Oracle数据更新、删除 
  99.      */  
  100.     public int fnExcuteUpdate(String sQuery) throws Exception{  
  101.         int bReturn=0;  
  102.         try{  
  103. //          conn = fnInitConnetion();  
  104.             if(stmt!=null){  
  105. //              stmt = conn.createStatement();  
  106.                 bReturn = stmt.executeUpdate(sQuery);  
  107.             }  
  108.         }catch(Exception e){  
  109.             e.printStackTrace();  
  110.         }  
  111.         return bReturn;  
  112.     }  
  113.       
  114.     /* 
  115.      * @关闭conn、stmt、rset对象 
  116.      */  
  117.     public void fnCloseObject() throws Exception{  
  118.         try {  
  119.             if(rset!=null){  
  120.                 rset.close();  
  121.             }  
  122.             if(stmt!=null){  
  123.                 stmt.close();  
  124.             }  
  125.             if(conn!=null){  
  126.                 conn.close();  
  127.             }                 
  128.         } catch (Exception e) {  
  129.             e.printStackTrace();  
  130.         }  
  131. <span style="margin: 0px; padding: 0px; border: none; color: black; background
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值