Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java²Ù×÷oracleÊý¾Ý¿â

 package com.chinacache.boss.queryservice.service.impl;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.chinacache.boss.queryservice.exception.BusinessException;
import oracle.sql.ArrayDescriptor;
public class Main {
public static void main(String[] args) throws Exception {
Connection conn = null;
PreparedStatement pstmt = null;
java.sql.Array sqlArray = null;
conn = getOracleConnection();
// For oracle you need an array descriptor specifying
// the type of the array and a connection to the database
// the first parameter must match with the SQL ARRAY type created
ArrayDescriptor arrayDescriptor = ArrayDescriptor.createDescriptor(
"CHAR_ARRAY", conn);// CREATE OR REPLACE TYPE CHAR_ARRAY AS table OF VARCHAR2(255)
// then obtain an Array filled with the content below
String[] content = { "5137", "V2", "V3", "V4" };
sqlArray = new oracle.sql.ARRAY(arrayDescriptor, conn, content);
pstmt = conn.prepareStatement(""
+ "select * "
+ "from bandwith_area_test t where t.channel_id in (select * from the (select cast(? as CHAR_ARRAY) from dual)) and t.area_id = ?" + "and t.day >= ? and t.day <= ? order by t.day");
Date start = null;
Date end = null;

try {
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmm");
start = df.parse("200907011000");
end = df.parse("200907012000");
} catch (ParseException e) {
e.printStackTrace();
throw new BusinessException(e.getMessage());
}

pstmt.setArray(1, sqlArray);
pstmt.setString(2, "9050");
pstmt.setDate(3, new java.sql.Date(start.getTime()));
pstmt.setDate(4, new java.sql.Date(end.getTime()));
int rowCount = pstmt.executeUpdate();
System.out.println("rowCount=" + rowCount);
System.out.println("--Demo_PreparedStatement_SetArray end--");
pstmt.close(


Ïà¹ØÎĵµ£º

´ÓJavaÓ¦ÓóÌÐò¶¯Ì¬Éú³ÉPDFÎļþ

 http://hi.baidu.com/skeryl/blog/item/d9b74e081e1d423ae92488ac.html
Èç¹ûÓ¦ÓóÌÐòÐèÒª¶¯Ì¬Éú³É PDF Îĵµ£¬ÔòÐèÒª iText ¿â¡£¿ª·ÅÔ´ÂëµÄ iText ¿âʹ PDF ÎĵµµÄ´´½¨Äܹ»ÔÚ˲¼äÍê³É¡£±¾ÎĽéÉÜÁË iText ²¢ÌṩÁËʹÓÃËü´Ó Java ? ¼¼ÊõÓ¦ÓóÌÐòÉú³É PDF ÎĵµµÄÓÉdzÈëÉîµÄÖ¸ÄÏ¡£ÎÒÃÇ´´½¨ÁËÒ»¸öʾÀýÓ¦ÓóÌÐòÒÔ¸üºÃµØÀí½â ......

Java Filter¹ýÂËÆ÷ʹÓÃ

±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔسö´¦£ºhttp://blog.csdn.net/royaki/archive/2009/05/07/4159279.aspx
 1¡¢½¨Á¢Ò»¸öServlet²¢ÇÒʵÏÖFilter½Ó¿Ú
¸ÃÀàÐèҪʵÏÖFilter½Ó¿ÚÖеÄinit()   doFilter()    destory()·½·¨
ÆäÖÐinit()·½·¨×Ô¶¯ÔÚÏîÄ¿Æô¶¯µÄʱºò¼ÓÔØ£¬doFilter()ÔÚµ÷ÓÃxmlÅäÖõÄ·¾¶ÊǼÓÔØ£¬d ......

Java Filter ¹ýÂËÆ÷µÄʹÓÃ

1¡¢½¨Á¢Ò»¸öServlet²¢ÇÒʵÏÖFilter½Ó¿Ú
¸ÃÀàÐèҪʵÏÖFilter½Ó¿ÚÖеÄinit()   doFilter()    destory()·½·¨
ÆäÖÐinit()·½·¨×Ô¶¯ÔÚÏîÄ¿Æô¶¯µÄʱºò¼ÓÔØ£¬doFilter()ÔÚµ÷ÓÃxmlÅäÖõÄ·¾¶ÊǼÓÔØ£¬destory()·½·¨ÔÚÍ˳öÏîÄ¿µÄʱºò½øÐС£
 
public class TestFilter implements Filter{
  ......

JavaÕýÔò±í´ïʽµÄ½âÊÍ˵Ã÷


±í´ïʽÒâÒ壺
1.×Ö·û
x    ×Ö·û x¡£ÀýÈça±íʾ×Ö·ûa
\\    ·´Ð±Ïß×Ö·û¡£ÔÚÊéдʱҪдΪ\\\\¡££¨×¢Ò⣺ÒòΪjavaÔÚµÚÒ»´Î½âÎöʱ,°Ñ\\\\½âÎö³ÉÕýÔò±í´ïʽ\\£¬ÔÚµÚ¶þ´Î½âÎöʱÔÙ½âÎöΪ\£¬ËùÒÔ·²ÊDz»ÊÇ1.1Áоٵ½µÄתÒå×Ö·û£¬°üÀ¨1.1µÄ\\,¶øÓÖ´øÓÐ\µÄ¶¼ÒªÐ´Á½´Î£©
\0n    ´øÓа ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ