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

Java Application Ö±½Óͨ¹ýjndiÁ¬½ÓÊý¾Ý¿â

 Ê¹ÓÃjar°ü:
 commons-pool-1.5.3.jar,tomcat-naming-common.jar,commons-pool-1.5.3-bin.zip,commons-dbcp.jar
 ×¢Òâ:jdbc Çý¶¯ÒªÓëÊý¾Ý¿â¼æÈÝ.
 package test.comm;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
public class DBConnector {
static private InitialContext ic = null;
static private DataSource ds = null;

static private void initContext(){
try {

BasicDataSource bds = new BasicDataSource();
bds.setUrl("jdbc:oracle:thin:@localhost:1521:test");
bds.setDriverClassName("oracle.jdbc.OracleDriver");
bds.setUsername("test");
bds.setPassword("a");

Hashtable<String, String> evn = new Hashtable<String,String>();
evn.put("java.naming.factory.initial","org.apache.naming.java.javaURLContextFactory");
ic = new InitialContext(evn);
ic.bind("mydatasource", bds);
ds = (DataSource) ic.lookup("mydatasource");
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

static public Connection getConn() throws SQLException{
if (ds == null){
initContext();
}
return ds.getConnection();
}


}

²âÊÔ:
package test;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import test.comm.DBConnector;
public class wfTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Connection conn = DBConnector.getConn();
System.out.println("conn = "+conn);
String qSQL = "SELECT USERNAME,LOGINID from S_U_USER";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(qSQL);

while (rs.next()){
System.out.println(rs.getString("USERNAME"));
System.out.print("


Ïà¹ØÎĵµ£º

sql 2005 ´æ´¢¹ý³Ì·ÖÒ³ java ´úÂë

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ ......

java½âÎöxmlÎļþËÄÖÖ·½Ê½

 from: http://blog.csdn.net/WOSHISUNXIANGFU/archive/2008/08/25/2828634.aspx
 1.½éÉÜ
1£©DOM£¨JAXP Crimson½âÎöÆ÷£©
DOMÊÇÓÃÓëƽ̨ºÍÓïÑÔÎ޹صķ½Ê½±íʾXMLÎĵµµÄ¹Ù·½W3C±ê×¼¡£DOMÊÇÒÔ²ã´Î½á¹¹×éÖ¯µÄ½Úµã»òÐÅϢƬ¶ÏµÄ¼¯ºÏ¡£Õâ¸ö²ã´Î½á¹¹ÔÊÐí¿ª·¢ÈËÔ±ÔÚÊ÷ÖÐÑ°ÕÒÌض¨ÐÅÏ¢¡£·ÖÎö¸Ã½á¹¹Í¨³£ÐèÒª¼ÓÔØÕû¸öÎĵµ ......

ÿ¸öÏîÄ¿ÖУ¬Äã²»µÃ²»ÖªµÄ11¸öJavaµÚÈý·½Àà¿â

JavaµÚÈý·½library ecosystemÊÇÒ»¸öºÜ¹ãÀ«µÄ·¶³ë¡£²»¾ÃÇ°ÓÐÈË׫ÎÄ£ºÃ¿¸öÏîÄ¿ÖУ¬Äã±ØÐëÖªµÀµÄ11¸öJavaµÚÈý·½Àà¿â¡£
µ¥Ôª²âÊÔ
1.DBUnit
DBunitÊÇÒ»¸ö»ùÓÚjunitÀ©Õ¹µÄÊý¾Ý¿â²âÊÔ¿ò¼Ü¡£ËüÌṩÁË´óÁ¿µÄÀà¶ÔÓëÊý¾Ý¿âÏà¹ØµÄ²Ù×÷½øÐÐÁ˳éÏóºÍ·â×°¡£
2.MOckito
MockitoÊÇÒ»¸öÕë¶ÔJavaµÄmocking¿ò¼Ü¡£Äã¿ÉÒÔʹÓüò½àµÄAPI±àд³ö ......

Effective Java¶ÁÊé±Ê¼Ç

package chape8;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* µÚ°ËÕ ͨÓóÌÐòÉè¼Æ
* µÚ45Ìõ£º ½«¾Ö²¿±äÁ¿µÄ×÷ÓÃÓò¼õСµ½×îС
*   ½«¾Ö²¿±äÁ¿µÄ×÷ÓÃÓò×îС»¯¡£¿ÉÒÔÔöÇ¿´úÂëµÄ¿É¶ÁºÍ¿Éά»¤ÐÔ£¬²¢½µµÍ³ö´íµÄ¿ÉÄÜÐÔ
*   Ҫʹ×÷ÓÃÓò×îС£¬×îÓÐÁ ......

jakarta regexp (java strutsÕýÔò±í´ïʽ)


  Character Classes
      [abc]                  Simple character class
      [a-zA-Z]            ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ