数据加载中……

2011年9月7日

trigger

create or replace trigger pm4h_hw_db.t_get_sys_bhstore
  after insert on pm4h_ad.sys_bhstore
declare
  pragma autonomous_transaction;
  tablename varchar2(64);
  cursor cr is
    select bhtable from pm4h_ad.sys_bhstore where bhmodelid = 'TODBH';
begin
  open cr;
  fetch cr
    into tablename;
  while cr%found loop
    if fun_is_exists_table(tablename) = 0 then
      pm4h_hw_db.create_bh_table(tablename);
    end if;
    fetch cr
      into tablename;
  end loop;
  close cr;
end pm4h_hw_db.t_get_sys_bhstore;

posted @ 2011-09-07 16:45 陈碧滔 阅读(109) | 评论 (0)编辑 收藏

2011年9月6日

不使用spring读取ApplicationContet.xml文件中数据库配置

在web应用没有启用之前我们需要对数据库进行操作,此事spring没有加载完成,我们依然可以使用jdbc对数据库进行操作。
实现方法如下
配置一个struts监听器,
实现ServletContextListener接口
public class HuaweiDBListener implements ServletContextListener {

}
实现接口中方法
public void contextInitialized(ServletContextEvent context) {
    String serverPath = context.getServletContext().getRealPath("/"); 
    ApplicationContext appC= new FileSystemXmlApplicationContext(serverPath + "WEB-INF\\spring\\applicationContext.xml"); 
    ComboPooledDataSource c = (ComboPooledDataSource) appC.getBean("dataSource"); 
    System.out.println("DriverClass=="+ c.getDriverClass());
}


使用ComboPooledDataSource对象直接从ApplicationContet.xml中得到数据源配置。

posted @ 2011-09-06 22:00 陈碧滔 阅读(282) | 评论 (0)编辑 收藏
开始写bolg

今天开始写bolg,慢慢记录自己技术上的成长~~~

posted @ 2011-09-06 21:53 陈碧滔 阅读(109) | 评论 (0)编辑 收藏
仅列出标题