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(
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
Ä¿±ê£ºÊµÏÖÒ»¸öºº×Ö×Ö·û´®°´ººÓïÆ´Òô×Öµä˳ÐòÅÅÐò¡£
ÔÀí£ºÔÚwindows»·¾³µÄgbk×Ö·û¼¯Àºº×ÖÊǰ´ººÓïÆ´Òô×Öµä˳Ðò±àÂëµÄ£¬Èç“´¡”ÊÇB4A1£¬“´¢”ÊÇB4A2¡£ÕâÀïÓиöÎÊÌâ¾ÍÏñÉÏÃæµÄ´¢ºÍ´¡ÕâÑùµÄͬÒô×ÖÖ»ÄÜ×ñÕÕ±àÂëµÄ˳ÐòÁË£¬ÁíÍâ¶àÒô×ÖÒ²µÃ×ñÕÕ±àÂë˳Ðò¡£Éè¼ÆË¼Â·ÊÇÏȲð·Öºº×Ö×Ö·û´®Îª×Ö·ûÊý×飬»ñµÃÿ ......
Java ¾²Ì¬´úÀíºÍ¶¯Ì¬´úÀí
http://kuangbaoxu.javaeye.com/blog/192804
¹Ø¼ü×Ö: ¾²Ì¬´úÀíÓ붯̬´úÀí
1. ´úÀíģʽÖ÷ÒªÓÐÁ½ÖÖ£º¾²Ì¬´úÀíºÍ¶¯Ì¬´úÀí
2. ¾²Ì¬´úÀí£º
±ÈÈçÒªÔÚÊä³ö“HelloWorld”ǰ´òÓ¡Ò»¸ö×Ö·û´®“Welcome”
A:Ïȶ¨ÒåÒ»¸ö½Ó¿ÚÀà
Java´úÂë
pac ......
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔسö´¦£ºhttp://blog.csdn.net/royaki/archive/2009/05/07/4159279.aspx
1¡¢½¨Á¢Ò»¸öServlet²¢ÇÒʵÏÖFilter½Ó¿Ú
¸ÃÀàÐèҪʵÏÖFilter½Ó¿ÚÖеÄinit() doFilter() destory()·½·¨
ÆäÖÐinit()·½·¨×Ô¶¯ÔÚÏîÄ¿Æô¶¯µÄʱºò¼ÓÔØ£¬doFilter()ÔÚµ÷ÓÃxmlÅäÖõÄ·¾¶ÊǼÓÔØ£¬d ......
ÔÚ·Ö²¼Ê½·þÎñ¿ò¼ÜÖУ¬Ò»¸ö×î»ù´¡µÄÎÊÌâ¾ÍÊÇÔ¶³Ì·þÎñÊÇÔõôͨѶµÄ£¬ÔÚJavaµ×²ãÁìÓòÖÐÓкܶà¿ÉʵÏÖÔ¶³ÌͨѶµÄ¼¼Êõ£¬ÀýÈ磺RMI¡¢MINA¡¢ESB¡¢Burlap¡¢SOAP¡¢EJBºÍJMS µÈ£¬ÔÚj2eeÖÐ,¶Ôjavaµ×²ãÔ¶³ÌͨѶµÄ¼¼Êõ½øÐÐÁË·â×°,ÐγÉÁË Hessian ¡¢ HttpInvoker ¡¢ XFire ¡¢ Axis µÈ¶àÖÖÐÎʽµÄÔ¶³Ìµ÷Óü¼Êõ¡£ µ«¶Ô¸ß¼¶³ÌÐòÔ±¶øÑÔÈÔÐ ......