学习资料1

1.右键项目-》属性-》java bulid path-》jre System Library-》access rules-》resolution选择accessible,下面填上** 点击确定即可!!!

2.

在MyEclipse中编写Java代码时,用到了BASE64Decoder,import sun.misc.BASE64Decoder;可是Eclipse提示:
Access restriction: The type BASE64Decoder is not accessible due to restriction on required library C:\Program
files\java\jre6\lib\rt.jar
Access restriction : The constructor BASE64Decoder() is not accessible due to restriction on required library C:\Program files\java\jre6\lib\rt.jar

解决方案1(推荐):
只需要在project build path中先移除JRE System Library,再添加库JRE System Library,重新编译后就一切正常了。
解决方案2:
Windows -> Preferences -> Java -> Compiler -> Errors/Warnings ->
Deprecated and trstricted API -> Forbidden reference (access rules): -> change to warning
 
 
2.验证码
http://www.jb51.net/article/42157.htm
 
 
3.调用存储过程
  1. package cn.edu.jdbc;  
  2.   
  3. import java.sql.CallableStatement;  
  4. import java.sql.Connection;  
  5.   
  6. import oracle.jdbc.OracleTypes;  
  7.   
  8. import org.junit.Test;  
  9. /** 
  10.  * create or replace procedure queryempinform(eno in number, 
  11.                                            pename out varchar2, 
  12.                                            psal out number, 
  13.                                            pjob out varchar2) 
  14.  * @author wf 
  15.  * 
  16.  */  
  17. public class TestProcedure {  
  18.     @Test  
  19.     public void testProcedure(){  
  20.         //{call <procedure-name[(<arg1>,<arg2>,<arh3>...)]>}  
  21.         String sql = "{call queryempincome1(?,?,?,?)}";  
  22.           
  23.         Connection connection = null;  
  24.         CallableStatement call = null;  
  25.         try {  
  26.             //得到一個连接  
  27.             connection = JDBCUtils.getConnection();  
  28.             //通过连接创建输出statement  
  29.             call = connection.prepareCall(sql);  
  30.               
  31.             //对于in(输入)参数,要赋值  
  32.             call.setInt(1, 2);//为第一个存储过程的参数赋值为1表示查询编号为1的员工信息  
  33.               
  34.             //对于out(输出),需要申明  
  35. //          call.registerOutParameter(2, sqlType);  
  36.             call.registerOutParameter(2, OracleTypes.VARCHAR);//指定oracle的输出参数类型  
  37.             call.registerOutParameter(3, OracleTypes.NUMBER);  
  38.             call.registerOutParameter(4, OracleTypes.VARCHAR);  
  39.               
  40.             //执行调用  
  41.             call.execute();  
  42.               
  43.             //取出结果  
  44.             String name = call.getString(2);  
  45.             Double sal = call.getDouble(3);  
  46.             String job = call.getString(4);  
  47.             System.out.println("姓名:"+name+"\t"+"薪水:"+sal+"\t"+"工作:"+job);  
  48.               
  49.         } catch (Exception e) {  
  50.             e.printStackTrace();  
  51.         }  
  52.     }  
  53.  

  54. 4. tomcat启动错误
  55.  tomcat启动servlet项目  java.lang.illegalstateexception containerBase.addChild
  56.    1.jar冲突  (如jstl.jar)
  57.    2.  tomcat.util.scan.DefaultJarScanner.jarsToSkip=\ 值后面加",*"。
  58. 4.  
    1. /*            BufferedReader br = new BufferedReader(new InputStreamReader(  
                          (ServletInputStream) request.getInputStream(), "utf-8"));  
                  StringBuffer sb = new StringBuffer("");  
                  String temp;  
                  while ((temp = br.readLine()) != null) {  
                      sb.append(temp);  
                  }  
                  br.close();  
                  String backStr = sb.toString();
                  JSONObject json=new JSONObject(backStr);
                  json.getString("");*/

posted on 2016-09-05 18:44  上雨  阅读(195)  评论(0编辑  收藏  举报

导航