JSPÊý¾Ý¿âÁ¬½ÓÒÉÎÊ£¨Mysql£©
package com.wxpn.tutorial.db;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
import java.util.Date;
/**
* ÃèÊö: Êý¾Ý¿âÁ¬½Ó³ØÀà
*
*
* @version 1.0
*/
public class ConnectionPool implements Runnable {
private boolean _debug = false;
private Thread runner;
private Connection[] connPool;
private int[] connStatus; // (0) available; (1) locked by the client; (2)
// locked by the housekeeping thread
private long[] connLockTime;
private long[] connCreateTime;
private String[] connID;
private String dbdriver, dbserver, dbuser, dbpassword;
private int currConnections, connLast, minconns, maxconns, maxconnMSec;
// available: set to false on destroy, checked by getConnection()
private boolean available = true;
private SQLWarning currSQLWarning;
/**
* Creates a new Connection Broker<br>
*
* @param dbdriver
* JDBC driver. e.g. 'oracle.jdbc.driver.OracleDriver'<br>
* @param dbserver
* JDBC connect string. e.g.
* 'jdbc:oracle:thin:@203.92.21.109:1526:orcl'<br>
* @param dbuser
* Database login name. e.g. 'Scott'<br>
* @param dbpassword
* Database password. e.g. 'Tiger'<br>
* @param minconns
* Minimum number of connections to start with.<br>
* @param maxconns
* &
Ïà¹ØÎĵµ£º
JSP µÄÄÚÖöÔÏóÓУºresquest ¡¢response¡¢session¡¢ application ¡¢out¡£ÒÔÏÂÎÒÃǽ«
Ò»Ò»½éÉÜ¡£
response ºÍrequest ¶ÔÏóÊÇJSP µÄÄÚÖöÔÏó½ÏÖØÒªµÄÁ½¸ö£¬ÕâÁ½¸ö¶ÔÏóÌṩÁ˶ԷþÎñ
Æ÷ºÍä¯ÀÀÆ÷ͨÐÅ·½·¨µÄ¿ØÖÆ¡£Ö±½ÓÌÖÂÛÕâÁ½¸ö¶ÔÏóÇ°£¬ÒªÏȶÔHTTP ÐÒé----Word Wide
Webµ×²ãÐÒé×÷¼òµ¥½éÉÜ¡£
Word Wide WebÊÇÔõÑùÔËÐеÄÄØ£ ......
MySQLÈÕÆÚ×ֶηÖDateºÍTimeÁ½ÖÖ£¬oracleÈÕÆÚ×Ö¶ÎÖ»ÓÐDate£¬°üº¬ÄêÔÂÈÕʱ·ÖÃëÐÅÏ¢£¬Óõ±Ç°Êý¾Ý¿âµÄϵͳʱ¼äΪsysdate,¾«È·µ½Ã룬»òÕßÓÃ×Ö·û´®×ª»»ÈÕÆÚÐͺ¯Êý£º
To_date('2001-08-01','YYYY-MM-DD'); Äê-ÔÂ-ÈÕ
24Сʱ£º·ÖÖÓ£ºÃëµÄ¸ñʽ 'YYYY-MM-DD HH24:MI:SS'  ......
MySQLÖеÄÁ÷³Ìº¯Êý
º¯Êý
¹¦ÄÜ
IF(value,t ,f)
Èç¹ûvalueΪÕ棬·µ»Øt£¬·ñÔò·µ»Øf
IFNULL(value1,value2)
Èç¹ûvalue1²»Îª¿Õ·µ»Øvalue1,·ñÔò·µ»Øvalue2
CASE WHEN [value1] THEN [result1] … ELSE [default] END
Èç¹ûvalue1ΪÕæ ·µ»Øresult2 ·ñÔò·µ»Ødefault
CASE [expr] WHEN [value1] THEN [result1] &helli ......
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>index</title>
<meta http-equiv="pragma" content="no-cache"&g ......