学习资料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
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.调用存储过程
- package cn.edu.jdbc;
- import java.sql.CallableStatement;
- import java.sql.Connection;
- import oracle.jdbc.OracleTypes;
- import org.junit.Test;
- /**
- * create or replace procedure queryempinform(eno in number,
- pename out varchar2,
- psal out number,
- pjob out varchar2)
- * @author wf
- *
- */
- public class TestProcedure {
- @Test
- public void testProcedure(){
- //{call <procedure-name[(<arg1>,<arg2>,<arh3>...)]>}
- String sql = "{call queryempincome1(?,?,?,?)}";
- Connection connection = null;
- CallableStatement call = null;
- try {
- //得到一個连接
- connection = JDBCUtils.getConnection();
- //通过连接创建输出statement
- call = connection.prepareCall(sql);
- //对于in(输入)参数,要赋值
- call.setInt(1, 2);//为第一个存储过程的参数赋值为1表示查询编号为1的员工信息
- //对于out(输出),需要申明
- // call.registerOutParameter(2, sqlType);
- call.registerOutParameter(2, OracleTypes.VARCHAR);//指定oracle的输出参数类型
- call.registerOutParameter(3, OracleTypes.NUMBER);
- call.registerOutParameter(4, OracleTypes.VARCHAR);
- //执行调用
- call.execute();
- //取出结果
- String name = call.getString(2);
- Double sal = call.getDouble(3);
- String job = call.getString(4);
- System.out.println("姓名:"+name+"\t"+"薪水:"+sal+"\t"+"工作:"+job);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- 4. tomcat启动错误
- tomcat启动servlet项目 java.lang.illegalstateexception containerBase.addChild
- 1.jar冲突 (如jstl.jar)
- 2. tomcat.util.scan.DefaultJarScanner.jarsToSkip=\ 值后面加",*"。
- 4.
- /* 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("");*/
- /* BufferedReader br = new BufferedReader(new InputStreamReader(