JOracle
人都是逼出来的(=o=)

2009年7月24日

oracle整库导出

今天create db instance,sqlplus 登录后遇到PLS-00201这个错:

SQL> set serveroutput on
ERROR:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'DBMS_OUTPUT.ENABLE' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored


SQL> exec dbms_output.enable(10000);
BEGIN dbms_output.enable(10000); END;

      *
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'DBMS_OUTPUT.ENABLE' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

解决办法:

1. use sysdba to execute two sql(/$Oracle_home/rdbms/admin).

logging as sysdba
try to run standard.sql,catalog.sql

2. use sys and system to execute these sql scrīpt

as SYS (or connect internal)
$Oracle_home/rdbms/admin/catalog.sql
$Oracle_home/rdbms/admin/catsnmp.sql
$Oracle_home/rdbms/admin/catexp7.sql
$Oracle_home/rdbms/admin/catproc.sql
$Oracle_home/rdbms/admin/caths.sql
as SYSTEM (not SYS)
$Oracle_home/rdbms/admin/catdbsyn.sql


unix 重启oracle

su -oracle
sqlplus / as sysdba
shutdown immediate;
startup
posted @ 2009-07-24 15:35 人在旅途 阅读(593) | 评论 (0) | 编辑 收藏
 

2008年10月15日

树状菜单 查询SQL

  有一表a     字段             a.dir   ,... 
  数据如下                      1               
                                1/01 
                                1/01/1 
                                1/02 
                                2 
                                。。。 
  表b           字段           b.dir,           b.class 
  数据如下                      1/01           b 
                                1/01           bb 
                                1/01/1       c 
                                1/01/1       cc 
                                1/01/1       cd 
                                1/02           e 
                                2                 f 
                                。。。 
  
求出对应a表每行对应b表的数据和,如下 
  
                dir               count 
                                1                   6 
                                1/01             5 
                                1/01/1         3 
                                1/02             1 
                                2                   1 
  


select   a.dir,[count]=count(b.class) 
  from   表a     a   join   表b   b   on   b.dir   like   a.dir+'%' 
  group   by   a.dir

posted @ 2008-10-15 15:36 人在旅途 阅读(649) | 评论 (0) | 编辑 收藏
 

2008年7月18日

基于StrutsTestCase的单元测试(Action测试方法)
采用Struts中的Mock方式模拟action和actionForm进行测试
基础类:STCRequestProcessor
作用:Ioc 将模拟的Action,ActionForm注入到struts-config.xml中的相应的action位置
   1. package test.sample.service.util;  
   
2. import java.io.IOException;  
   
3. import java.util.HashMap;  
   
4. import javax.servlet.http.HttpServletRequest;  
   
5. import javax.servlet.http.HttpServletResponse;  
   
6. import javax.servlet.http.HttpSession;  
   
7.   
   
8. import org.apache.struts.action.Action;  
   
9. import org.apache.struts.action.ActionForm;  
  
10. import org.apache.struts.action.ActionMapping;  
  
11. import org.apache.struts.action.RequestProcessor;  
  
12. import org.apache.struts.util.RequestUtils;  
  
13.   
  
14. /** *//** 
  15.  * 
@author administrator 
  16.  * 
  17.  * To change this generated comment edit the template variable "typecomment": 
  18.  * Window>Preferences>Java>Templates. 
  19.  * To enable and disable the creation of type comments go to 
  20.  * Window>Preferences>Java>Code Generation. 
  21.  
*/  
  
22. public class STCRequestProcessor extends RequestProcessor {  
  
23.   
  
24.     private static HashMap mockActionFormMap = new HashMap();  
  
25.     private static HashMap mockActionMap = new HashMap();  
  
26.   
  
27.     public static void addMockAction(String actionStr, String className)   
  
28.     {  
  
29.         mockActionMap.put(actionStr, className);  
  
30.     }  
  
31.     public static void addMockActionForm(String actionFormStr,String className)  
  
32.     {      
  
33.         mockActionFormMap.put(actionFormStr, className);  
  
34.     }  
  
35.     /** *//** 
  36.      * We will insert Mock ActionForm for testing through this method 
  37.      
*/  
  
38.     protected ActionForm processActionForm(  
  
39.         HttpServletRequest request,  
  
40.         HttpServletResponse response,  
  
41.         ActionMapping mapping) {  
  
42.   
  
43.           
  
44.         // Create (if necessary a form bean to use  
  45.         String formBeanName = mapping.getName();  
  
46.         String mockBeanClassName = (String) mockActionFormMap.get(formBeanName);  
  
47.         if (mockBeanClassName == null)  
  
48.             return super.processActionForm(request, response, mapping);  
  
49.   
  
50.         ActionForm instance = null;  
  
51.         try {  
  
52.             Class formClass = Class.forName(mockBeanClassName );  
  
53.             instance = (ActionForm) formClass.newInstance();  
  
54.         } catch (ClassNotFoundException e) {  
  
55.             e.printStackTrace();  
  
56.         } catch (InstantiationException e) {  
  
57.             e.printStackTrace();  
  
58.         } catch (IllegalAccessException e) {  
  
59.             e.printStackTrace();  
  
60.         }  
  
61.   
  
62.         instance.setServlet(servlet);  
  
63.         if (instance == null) {  
  
64.             return (null);  
  
65.         }  
  
66.   
  
67.         if (log.isDebugEnabled()) {  
  
68.             log.debug(  
  
69.                 " Storing ActionForm bean instance in scope '"  
  
70.                     + mapping.getScope()  
  
71.                     + "' under attribute key '"  
  
72.                     + mapping.getAttribute()  
  
73.                     + "'");  
  
74.         }  
  
75.         if ("request".equals(mapping.getScope())) {  
  
76.             request.setAttribute(mapping.getAttribute(), instance);  
  
77.         } else {  
  
78.             HttpSession session = request.getSession();  
  
79.             session.setAttribute(mapping.getAttribute(), instance);  
  
80.         }  
  
81.         return (instance);  
  
82.   
  
83.     }  
  
84.   
  
85.     /** *//** 
  86.      * We will insert Mock Action Class through this method 
  87.      
*/  
  
88.     protected Action processActionCreate(  
  
89.         HttpServletRequest request,  
  
90.         HttpServletResponse response,  
  
91.         ActionMapping mapping)  
  
92.         throws IOException {  
  
93.         String orignalClassName = mapping.getType();  
  
94.         String mockClassName = (String)mockActionMap.get(orignalClassName);  
  
95.         if( mockClassName == null )  
  
96.             return super.processActionCreate(request,response,mapping);  
  
97.         String className = mockClassName;          
  
98.         if (log.isDebugEnabled()) {  
  
99.             log.debug(" Looking for Action instance for class " + className);  
 
100.         }  
 
101.   
 
102.         Action instance = null;  
 
103.         synchronized (actions) {  
 
104.   
 
105.             // Return any existing Action instance of this class  
 106.             instance = (Action) actions.get(className);  
 
107.             if (instance != null) {  
 
108.                 if (log.isTraceEnabled()) {  
 
109.                     log.trace("  Returning existing Action instance");  
 
110.                 }  
 
111.                 return (instance);  
 
112.             }  
 
113.   
 
114.             // Create and return a new Action instance  
 115.             if (log.isTraceEnabled()) {  
 
116.                 log.trace("  Creating new Action instance");  
 
117.             }  
 
118.   
 
119.             try {  
 
120.                 instance = (Action) RequestUtils.applicationInstance(className);  
 
121.             } catch (Exception e) {  
 
122.                 log.error(  
 
123.                     getInternal().getMessage("actionCreate", mapping.getPath()),  
 
124.                     e);  
 
125.   
 
126.                 response.sendError(  
 
127.                     HttpServletResponse.SC_INTERNAL_SERVER_ERROR,  
 
128.                     getInternal().getMessage(  
 
129.                         "actionCreate",  
 
130.                         mapping.getPath()));  
 
131.   
 
132.                 return (null);  
 
133.             }  
 
134.   
 
135.             instance.setServlet(this.servlet);  
 
136.             actions.put(className, instance);  
 
137.         }  
 
138.   
 
139.         return (instance);  
 
140.     }  
 
141.   
 
142. }  
Test类:
setUp()方法:
super.setUp();//调用mockStrutsTestCase中的setUp方法
File web = new File("E:/project/portal/WebContent");
this.setContextDirectory(web);//定位工程包的位置
setConfigFile("/WEB-INF/web.xml");//定位工程中的web.xml位置
setConfigFile("/WEB-INF/struts-config.xml");//定位工程中struts-config.xml位置
STCRequestProcessor.addMockActionForm("ser_wordForm", "test.sample.service.form.MockWordForm");//注入模拟的form
STCRequestProcessor.addMockAction("com.huawei.service.action.WordAction","test.sample.service.action.MockWordAction");// 注入模拟的action
setRequestPathInfo("/service/word");//定义struts-config.xml中的path名称
   1. package test.sample.service.action;  
   
2.   
   
3.   
   
4. import java.io.File;  
   
5.   
   
6. import servletunit.struts.MockStrutsTestCase;  
   
7. import test.sample.service.util.STCRequestProcessor;  
   
8. /** *//** 
   9.  *  
  10. -  setContextDirectory,设置web应用的根  
  11. -  setRequestPathInfo,设置request的请求  
  12. -  addRequestParameter,将参数和对应的值加入request中  
  13. -  actionPerform,执行这个请求  
  14. -  verifyForward,验证forward的名字是否正确  
  15. -  verifyForwardPath,验证forward的path是否正确  
  16. -  verifyNoActionErrors,验证在action执行过程中没有ActionError产生  
  17. -  verifyActionErrors,验证在action执行过程中产生的ActionError集合的内容  
  18.  * 
@author donganlei 
  19.  * 
  20.  
*/  
  
21. public class MockWordActionTest extends MockStrutsTestCase {  
  
22.       
  
23.     public void testInvalidPageflag1()throws Exception{  
  
24.           addRequestParameter("reqCode","getWordList");  
  
25.           addRequestParameter("pageflag","userquery");  
  
26.           actionPerform();  
  
27.           verifyNoActionErrors();  
  
28.           verifyForward("querylist");  
  
29.     }  
  
30.       
  
31.     public void testInvalidPageflag2()throws Exception{  
  
32.           addRequestParameter("reqCode","getWordList");  
  
33.           addRequestParameter("pageflag","seatquery");  
  
34.           actionPerform();  
  
35.           verifyNoActionErrors();  
  
36.           verifyForward("querylist");  
  
37.     }  
  
38.       
  
39.     public void testInvalidInitUpdate()throws Exception{  
  
40.           addRequestParameter("reqCode","initUpdate");  
  
41.           actionPerform();  
  
42.           verifyNoActionErrors();  
  
43.           verifyForward("update");  
  
44.     }  
  
45.     public void testinitUpdate()throws Exception{  
  
46.           addRequestParameter("reqCode","initUpdate");  
  
47.           addRequestParameter("wordid","3");  
  
48.           addRequestParameter("roomid","3");  
  
49.           actionPerform();  
  
50.           verifyNoActionErrors();  
  
51.           verifyForward("update");  
  
52.     }  
  
53.     protected void setUp() throws Exception {  
  
54.         super.setUp();  
  
55.         File web = new File("E:/project/portal/WebContent");  
  
56.         this.setContextDirectory(web);  
  
57.         setConfigFile("/WEB-INF/web.xml");  
  
58.         setConfigFile("/WEB-INF/struts-config.xml");  
  
59.         STCRequestProcessor.addMockActionForm("ser_wordForm", "test.sample.service.form.MockWordForm");  
  
60.         STCRequestProcessor.addMockAction("com.huawei.service.action.WordAction","test.sample.service.action.MockWordAction");  
  
61.         setRequestPathInfo("/service/word");  
  
62.     }  
  
63.     public static void main(String args[]){  
  
64.         junit.textui.TestRunner.run(MockWordActionTest.class);  
  
65.     }    
  
66. }  
Struts-congfig.xml中的processorClass
<controller>
<set-property property="processorClass" value="test.sample.service.util.STCRequestProcessor"/>
</controller>
posted @ 2008-07-18 11:22 人在旅途 阅读(732) | 评论 (0) | 编辑 收藏
 
基于DBUnit的manage(Dao)单元测试
     摘要: TestDBConnection父类 所有test类继承该类Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->   1. package test.sample.service.util;     2.      3. import java.io.Fi...  阅读全文
posted @ 2008-07-18 11:20 人在旅途 阅读(583) | 评论 (0) | 编辑 收藏
 

2008年4月24日

apache与weblogic整合

web服务器与应用服务器的整合中,apache与weblogic 的整合算的上最普遍也是最基础的整合了
今天配置了一下:
apache 2.0
weblogic 8.1
1.将weblogic中的mod_wl_22.so 拷贝到 apache的modules目录下
(*注:weblogic8.1中没有针对apache2.2版的mod_wl_22.so,只有针对apache2.0版的mod_wl_20.so ,需要从别的地方比如down一个)
2.配置apache下的httpd.conf文件
(1)<Directory "应用程序目录"></Directory>//配置apache启动时的访问路径
(2)<IfModule dir_module>
             DirectoryIndex index.htm    //配置apache的默认访问文件
         </IfModule>
(3)LoadModule weblogic_module modules/mod_wl_22.so//加载weblogic的module
(4)<IfModule mod_weblogic.c>
             WebLogicHost 127.0.0.1//配置应用程序的主机地址
             WebLogicPort 7001 //配置端口
             MatchExpression *.jsp //配置匹配文件
             MatchExpression *.do
             MatchExpression */portal/*
         </IfModule>
(注 4是配单服务是配置,配置集群服务

      <IfModule mod_weblogic.c>
             WebLogicCluster 192.168.0.100:7001,192.168.0.52:7001  //集群下各个应用的addr+port
             MatchExpression *.jsp
             MatchExpression *.*
             MatchExpression *
      </IfModule>
)

 
posted @ 2008-04-24 13:36 人在旅途 阅读(896) | 评论 (6) | 编辑 收藏
 

2007年7月18日

下拉的文本框限定大小,而里面的内容比文本框的长度长
 <span style="width:130; solid black;overflow:hidden">
<select></select>
</span>
posted @ 2007-07-18 10:48 人在旅途 阅读(170) | 评论 (0) | 编辑 收藏
 

2007年4月24日

SSH+ajax学习笔记(一)
1。基础的就不说了,配置环境 。用MYECLIPSE傻瓜式的点下一步就行
      注意的是最好在WEB.XML中配一下applicationContext的监听器。
      容易犯错:1。找不到action : 原因找不到applicationContext.xml路径,在classes下面
                        2。找不到项目包:原因 web.xml配的不对,加个spring的路径就行了。
2。hibernate 的查询:
      hql一开始确实用的不顺,关键是sql用常了,面向POJO的查询刚用比较痛苦。昨天看了个帖子说要学hql去查hibernate的API。。这个人纯粹扯淡。hibernate的API里面一大堆全TMD 是看不懂的难记的类明,找了半天也没个介绍hql的。BS这个闭着眼装明白的帖子。
初学hibernate 读读doctor王的深入浅出hibernate还是很有帮助的。
3。ajax 火热的领域,但还没有统一的标准。现在大多都是用的google的那套。
现在遇到一个问题:当一个系统的功能非常强,所需要后台的处理就相当的频繁。
是应该建多点的 action 响应呢 还是在已经有的action里多加 方法响应呢??
posted @ 2007-04-24 20:57 人在旅途 阅读(557) | 评论 (0) | 编辑 收藏
 

2006年1月11日

从txt文件中导数据
try{
Connection conn=DBManager.getConnection();
FileInputStream file=new FileInputStream("e:/t.txt");
BufferReader read=new BufferReader(new InputStreamReader(file));
String line="";
line=read.readLine();
int i=0;
while(line!=null){
   //语句
i=line.indexOf("");
Statement stat=conn.creatStatement();
String account="";
String password="";
String str1="";
StringTokenizer str=new StringTokenizer(line.subString(i+1),"");
while(str.hasMoreElement()){
   account=str.nextToken();
   password=str.nextToken();
   str1=str.nextToken();
   String sql="insert into table (account,password) values('"+account+" ' ,'  "+password+"   ' )";
stat.executeUpdate(sql);
}
   line=read.readLine();
}
}catch(FileNotFoundError e){
   e.printStackTrace();
}catch(IOException e){
   e.printStackTrace();
}catch(Exception e){]
   e.printStackTrace();
}
posted @ 2006-01-11 09:08 人在旅途 阅读(125) | 评论 (0) | 编辑 收藏
 

2005年10月24日

工作日志——权限管理

将权限分配好之后。就开始向页面中加入权限。
这可以有两种选择:
a、将没有权限的按钮屏蔽,不能点击
b、将没有权限的按钮做返回框,
我用的是第一种方法
几个表
user      roles      userinroles   和13个permission表
username,rolename,和permission表里的roleid都是唯一的便于关联。
系统共有13个模块,也就是13个权限组。
每个user中可对应多个权限名称,但属于每个模块的名称只能有一个
所以可以在用户登录时,对用户所携带的权限信息进行判断。
在判断时,将用户的角色名称给取出来。

posted @ 2005-10-24 16:35 人在旅途 阅读(229) | 评论 (0) | 编辑 收藏
 

2005年10月21日

test

posted @ 2005-10-21 08:46 人在旅途 阅读(92) | 评论 (0) | 编辑 收藏
 
仅列出标题  下一页
 
<2025年6月>
日一二三四五六
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

 导航

  • BlogJava
  • 首页
  • 发新随笔
  • 发新文章
  • 联系
  • 聚合
  • 管理

 统计

  • 随笔: 46
  • 文章: 14
  • 评论: 27
  • 引用: 0

常用链接

  • 我的随笔
  • 我的文章
  • 我的评论
  • 我的参与
  • 最新评论

留言簿(1)

  • 给我留言
  • 查看公开留言
  • 查看私人留言

随笔档案

  • 2010年5月 (1)
  • 2009年7月 (1)
  • 2008年11月 (1)
  • 2008年10月 (1)
  • 2008年8月 (1)
  • 2008年7月 (4)
  • 2008年3月 (4)
  • 2007年9月 (5)
  • 2007年7月 (2)
  • 2007年6月 (3)
  • 2007年5月 (1)
  • 2007年4月 (5)
  • 2007年3月 (1)
  • 2006年2月 (1)
  • 2006年1月 (3)
  • 2005年12月 (4)
  • 2005年10月 (5)
  • 2005年8月 (3)

文章档案

  • 2009年7月 (1)
  • 2008年10月 (1)
  • 2008年7月 (2)
  • 2008年4月 (1)
  • 2007年7月 (1)
  • 2007年4月 (1)
  • 2006年1月 (1)
  • 2005年10月 (2)
  • 2005年8月 (4)

收藏夹

  • drools(2) (rss)

搜索

  •  

积分与排名

  • 积分 - 30347
  • 排名 - 1377

最新评论

  • 1. re: jsp生成html文件
  • qchun100@163.com
  • --我也想要一份
  • 2. re: Oracle 导入导出命令(转)
  • ..
  • --pillow
  • 3. re: Oracle 导入导出命令(转)
  • 同上。
  • --粉丝机
  • 4. re: Oracle 导入导出命令(转)
  • 谢谢了。用命令导出,用sqlplus导入的,解决问题。
  • --竹子切片机
  • 5. re: Oracle 导入导出命令(转)
  • 路过,解决了。
  • --保健枕

阅读排行榜

  • 1. powerdesigner12 破解方法(2751)
  • 2. 正规式和有限自动机(转自csdn)(2398)
  • 3. oracle 导出建表sql和键索引sql(1850)
  • 4. web.config connectionStrings 数据库连接字符串的解释(1622)
  • 5. Oracle 导入导出命令(转)(1374)

评论排行榜

  • 1. powerdesigner12 破解方法(6)
  • 2. Oracle 导入导出命令(转)(4)
  • 3. 交叉表统计(1)
  • 4. JSP+JavaScript实现级联 不刷新页面(1)
  • 5. JSPCOUNTER(0)

Powered by: 博客园
模板提供:沪江博客
Copyright ©2025 人在旅途