JAVA Á¬½Ó³Ø BoneCP ²âÊÔ£¨2£© with spring 3
¶îÍâJAR°ü£º
org.springframework.expression-3.0.1.RELEASE.jar
org.springframework.asm-3.0.1.RELEASE.jar
org.springframework.beans-3.0.1.RELEASE.jar
p:statementCacheSize="100"
<bean id="masterDataSource" class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close"
p:driverClass="com.mysql.jdbc.Driver"
p:jdbcUrl="jdbc:mysql://localhost/pesdog?autoReconnectForPools=true&autoReconnect=true&characterEncoding=utf-8"
p:username="root" p:password=""
p:idleConnectionTestPeriod="60" p:idleMaxAge="240"
p:maxConnectionsPerPartition="30" p:minConnectionsPerPartition="10"
p:partitionCount="3" p:acquireIncrement="5"
p:releaseHelperThreads="3"
/>
<context:annotation-config/><bean id="foo" class="test.Foo">
</bean>
public static void main(String[] args){
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
Foo foo = (Foo)context.getBean("foo");
try{
foo.test();
}catch(Exception ex){
ex.printStackTrace();
}
}
@Component
public class Foo {
// @Autowired
private DataSource masterDataSource;
public DataSource getMasterDataSource() {
return masterDataSource;
}
@Required
@Autowired
public void setMasterDataSource(DataSource masterDataSource) {
this.masterDataSource = masterDataSource;
}
public void test() throws Exception{
Connection cn = this.masterDataSource.getConnection();
Statement stmt = cn.createStatement();
String sql = "select username,loginid from sys_user";
System.out.println(sql);
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()){
System.out.println(rs.getString("username"));
System.out.println(rs.getString("loginid"));
}
}
}
Ïà¹ØÎĵµ£º
jarÎļþÌý˵¹ýÂð£¬Ã»ÓУ¿»òÕßÄ°Éú£¡ºÃ£¬Ã»¹Øϵ£¬Õâ¾ÍÊÇÎÒÃǵĵÚÒ»Õ¾£º´ò°ü·¢²¼¡£
Ϊʲô»áÓÐÕâ¸öÍæÒâÄØ£¬Ê×ÏÈ£¬ÕâÊÇjarµÄÈ«³Æ£ºJavaTM Archive (JAR) file£¬Êǵģ¬¾ÍÊÇjava´æµµÎļþ¡£ÕâÓеãÀàËÆzipÎļþ£¬ÏëÒ»ÏëËüÊǸÉʲôµÄÓõÄÄØ£¬Ñ¹Ëõ£¡£¿Ã»´í¾ÍÊÇҪѹËõ£¬½«ÎÒÃÇÔÏÈÁãÉ¢µÄ¶«Î÷·Åµ½Ò»Ï£¬ÖØÐÂ×éÖ¯£¬ËùÓÐÕâЩĿµÄÖ»ÓÐÒ» ......
ÍƼö¼¸¸öjavaѧϰÍøÕ¾
Java´úÂë²éѯվµã S+\s4hh@k
1. java2s http://www.java2s.com/ PeYmf1ox
Õâ¸öÍøÕ¾·Ç³£ºÃ£¬·Ö³ÉÈý´óÀ࣬·Ö±ðÊÇExample¡¢Products¡¢ Articles£¬Ã¿¸ö´óÀàÏÂÓÖ·Ö±ðÉèÐí¶àСÀ࣬»¹ÓÐËÑË÷¹¦ÄÜ£¬ÕâÑù²éÕÒÆðÀ´·Ç³£·½±ã¡£¡£±ÈÈ磬Èç¹ûҪѧϰSWT/JFace£¬Ö»Òª°ÑExampleϵÄSWT JFace Eclipse ......
JAVAÓïÑÔÖеķ´Éä»úÖÆ£º
ÔÚJava ÔËÐÐʱ »·¾³ÖУ¬¶ÔÓÚÈÎÒâÒ»¸öÀ࣬ÄÜ·ñÖªµÀÕâ¸öÀàÓÐÄÄЩÊôÐԺͷ½·¨£¿
¶ÔÓÚÈÎÒâÒ»¸ö¶ÔÏó£¬ÄÜ·ñµ÷ÓÃËûµÄ·½·¨£¿ÕâЩ´ð°¸Êǿ϶¨µÄ£¬ÕâÖÖ¶¯Ì¬»ñÈ¡ÀàµÄÐÅÏ¢£¬ÒÔ¼°¶¯Ì¬µ÷ÓÃÀàµÄ·½·¨µÄ¹¦ÄÜÀ´Ô´ÓÚJAVAµÄ·´Éä¡£´Ó¶øʹjava¾ßÓж¯Ì¬ÓïÑÔµÄÌØÐÔ¡£
JAVA·´É ......
±¾ÎĽéÉÜJavaµÄBigDecimalÀàµÄÓ¦Óá£JavaÔÚjava.math°üÖÐÌṩµÄAPIÀàBigDecimal£¬ÓÃÀ´¶Ô³¬¹ý16λÓÐЧλµÄÊý½øÐо«È·µÄÔËËã¡£
BigDecimalÀà
Ë«¾«¶È¸¡µãÐͱäÁ¿double¿ÉÒÔ´¦Àí16λÓÐЧÊý¡£ÔÚʵ¼ÊÓ¦ÓÃÖУ¬ÐèÒª¶Ô¸ü´ó»òÕ߸üСµÄÊý½øÐÐÔËËãºÍ´¦Àí¡£JavaÔÚjava.math°üÖÐÌṩµÄAPIÀàBigDecimal£¬ÓÃÀ´¶Ô³¬¹ý16λÓÐЧλµÄÊý½øÐо«È· ......
¶ÔÓÚJava³ÌÐò£¬ÎÞÂÛÊÇδ´ò°üµÄ»¹ÊÇ´ò°üµÄJAR»òWARÎļþ£¬ÓÐʱºò¶¼ÐèÒª»ñÈ¡ËüÔËÐÐËùÔÚĿ¼ÐÅÏ¢£¬ÈçºÎ×öµ½ÕâÒ»µãÄØ£¿
ÔÚJava´¦ÀíµÄÎļþϵͳÖУ¬Ä¿Â¼µÄ±íʾ·½Ê½ÓÐÁ½ÖÖ£º
£¨1£©¾ø¶ÔĿ¼£¬ËüÒÔ"/"ΪÆðʼ×Ö·û£¬´ú±í´Ó¸ùĿ¼Ï¿ªÊ¼Ñ°ÕÒ¸ø³öµÄĿ¼£¬Èç/c:/java
£¨2£©Ïà¶Ô·¾¶£¬ËüÒÔ²»´ø“/”µÄĿ¼Ãû±íʾ£¬±íʾÒÔµ±Ç ......