JavaÊý¾Ý¿âÁ¬½Ó³Ø
javaÊý¾Ý¿âÁ¬½Ó³Ø
javaÊý¾Ý¿âÁ¬½Ó³Ø
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Enumeration;
import java.util.Vector;
/*ËäÈ»ÏÖÔÚÓÃAPACHE COMMONS DBCP¿ÉÒԷdz£·½±ãµÄ½¨Á¢Êý¾Ý¿âÁ¬½Ó³Ø£¬
µ«ÊÇÏñÕâƪÎÄÕ°ÑÊý¾Ý¿âÁ¬½Ó³ØµÄÄÚ²¿ÔÀíдµÄÕâô͸³¹£¬×¢ÊÓÕâôÍêÕû£¬
ÕæÊǷdz£Äѵã¬Èÿª·¢ÈËÔ±¿ÉÒÔ¸üÉî²ã´ÎµÄÀí½âÊý¾Ý¿âÁ¬½Ó³Ø£¬ÕæÊǷdz£¸Ð
лÕâƪÎÄÕµÄ×÷Õß¡£*/
public class ConnectionPool {
private String jdbcDriver = ""; // Êý¾Ý¿âÇý¶¯
private String dbUrl = ""; // Êý¾Ý URL
private String dbUsername = ""; // Êý¾Ý¿âÓû§Ãû
private String dbPassword = ""; // Êý¾Ý¿âÓû§ÃÜÂë
private String testTable = ""; // ²âÊÔÁ¬½ÓÊÇ·ñ¿ÉÓõIJâÊÔ±íÃû£¬Ä¬ÈÏûÓвâÊÔ±í
private int initialConnections = 10; // Á¬½Ó³ØµÄ³õʼ´óС
private int incrementalConnections = 5;// Á¬½Ó³Ø×Ô¶¯Ôö¼ÓµÄ´óС
private int maxConnections = 50; // Á¬½Ó³Ø×î´óµÄ´óС
private Vector connections = null; // ´æ·ÅÁ¬½Ó³ØÖÐÊý¾Ý¿âÁ¬½ÓµÄÏòÁ¿ , ³õʼʱΪ null
// ËüÖдæ·ÅµÄ¶ÔÏóΪ PooledConnection ÐÍ
/**
* ¹¹Ô캯Êý
*
* @param jdbcDriver String JDBC Çý¶¯Àà´®
* @param dbUrl String Êý¾Ý¿â URL
* @param dbUsername String Á¬½ÓÊý¾Ý¿âÓû§Ãû
* @param dbPassword String Á¬½ÓÊý¾Ý¿âÓû§µÄÃÜÂë
*
*/
public ConnectionPool(String jdbcDriver, String dbUrl, String dbUsername,
String dbPassword) {
this.jdbcDriver = jdbcDriver;
this.dbUrl = dbUrl;
this.dbUsername = dbUsername;
this.dbPassword = dbPassword;
try {
createPool();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* ·µ»ØÁ¬½Ó³ØµÄ³õʼ´óС
*
* @return ³õʼÁ¬½Ó³ØÖпɻñµÃµÄÁ¬½ÓÊýÁ¿
*/
public int getInitialConnections() {
return this.initialConnections;
}
/**
* ÉèÖÃÁ¬½Ó³ØµÄ³õʼ´óС
*
* @param ÓÃÓÚÉèÖóõʼÁ¬½Ó³ØÖÐÁ¬½ÓµÄÊýÁ¿
*/
public void setInitialConnections(int initialConnections) {
this.init
Ïà¹ØÎĵµ£º
1¡¢Óï·¨£º±ØÐë±È½ÏÊìϤ£¬ÔÚд´úÂëµÄʱºòIDEµÄ±à¼Æ÷¶ÔijһÐб¨´íÓ¦¸ÃÄܹ»¸ù¾Ý±¨´íÐÅÏ¢ÖªµÀÊÇʲôÑùµÄÓï·¨´íÎó²¢ÇÒÖªµÀÈκÎÐÞÕý¡£
2¡¢ÃüÁ±ØÐëÊìϤJDK´øµÄһЩ³£ÓÃÃüÁî¼°Æä³£ÓÃÑ¡ÏÃüÁîÖÁÉÙÐèÒªÊìϤ£ºappletviewer¡¢ HtmlConverter¡¢jar¡¢ java¡¢javac¡¢javadoc¡¢javap¡¢javaw¡¢native2ascii¡ ......
JMF:(JavaTM Media Framework)ÊÇ´¦Àí¶àýÌåµÄ³ÌÐò½Ó¿Ú¡£
JMF¿ò¼ÜÖ÷ÒªÓÐÈýÖÖÄ£ÐÍ£¬·Ö±ðÊÇʱ¼äÄ£ÐÍ£¬Ê¼þÄ£ÐÍÒÔ¼°Êý¾ÝÄ£ÐÍ¡£Ê±¼äÄ£ÐͶ¨ÒåÁËJMFµÄ´¦ÀíýÌåÁ÷µÄʱ¼äÊý¾ÝµÄ½á¹¹¡£Ê¼þÄ£ÐͶ¨ÒåÁËJMF¿ò¼ÜµÄʼþÀàÐÍÒÔ¼°¸÷¸öʼþÀàÐÍÖ®¼äµÄ¹Øϵ¡£Êý¾ÝÀàÐͶ¨ÒåÁËJMF´¦ÀíµÄýÌåÁ÷Êý¾ÝµÄÀàÐÍ¡£
ʱ¼äÄ£ÐÍ
......
/***************¶¨Òå½Ó¿Ú******************/
package day6;
public interface StudentDao {
public void insert();
public void update();
public void delete();
public void query();
public void FindById();
}
/***************¶¨Òå½Ó¿Ú ½èËÞ***************** ......
JavaÃæÊÔÌâ—»ù´¡·½Ãæ:
1¡¢×÷ÓÃÓòpublic,private,protected,ÒÔ¼°²»Ð´Ê±µÄÇø±ð£¿
´ð£ºÇø±ðÈçÏ£º
×÷ÓÃÓò µ±Ç°Àà ͬһpackag ×ÓËïÀà ÆäËûpackage
public √ √ √ √
protected √ √ √ ×
friendly √ √ × ×
pr ......
package com.hefeng.test;
import java.text.DateFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util ......