JavaÁ¬½ÓDB2Ïà¹Ø
1. ¹ØÓÚConnection Pool
JDBC±¾Éí²»ÌṩÁ¬½Ó³Ø¼¼Êõ£¬ÐèÒªµÚÈý·½¿âµÄÖ§³Ö¡£
ÔÚÐèҪƵ·±»ñµÃÁ¬½ÓµÄApplicationÖÐ×îºÃÓÃConnection Pool£¬ÈçWeb ApplicationÖÐ
¶ÔÓÚÒ»°ãµÄJava ApplicationÔò¿ÉÒÔÖ±½ÓÓÃJDBCÁ¬½ÓÊý¾Ý¿â¡£
2. Java ApplicationÖÐÁ¬½ÓDB2
°²×°DB2 Personal Edition V9Ö®ºó£¬ÔÚÆäÖеÄjavaĿ¼¿ÉÒÔÕÒµ½ÕâÁ½¸öÎļþ£ºdb2jcc.jar; db2jcc_license_cu.jar
db2jcc.jarÖеÄcom.ibm.db2.jcc.DB2DriverÇý¶¯³ÌÐò±»³ÆΪͨÓÃÇý¶¯£¬ÍƼöʹÓã¨ÔÒò¿´µÚ5µã£©¡£ÔÚʹÓÃËüʱ£¬ÐèÒªdb2jcc_license_cu.jar£¬·ñÔò»áÌáʾûÓÐlicense¶øÎÞ·¨¹¤×÷¡£
DB2µÄÁ¬½ÓµØÖ·£ºjdbc:db2://localhost:50000/Database
3. Web ApplicationÖÐÁ¬½ÓDB2
Ò»¡¢ÒÔWASΪÀý£¬ÅäÖÃDB2 Data Source
1) ½øÈë¿ØÖÆ̨
Æô¶¯Websphere6.0·þÎñ£¬ ´ò¿ªä¯ÀÀÆ÷£¬ÔÚµØÖ·À¸ÖÐÊäÈ룺http://localhost:9060/ibm/console/£¬µÇ½Websphere6.0¹ÜÀí¿ØÖÆ̨
2) ÉèÖû·¾³±äÁ¿
ÔÚµ¼º½À¸×ó²àÑ¡Ôñ: Environment -> Websphere Variables, ÕÒµ½DB2UNIVERSAL_JDBC_DRIVER_PATH, ÊäÈëDB2Êý¾Ý¿âÇý¶¯jar°üµÄλÖ㬱ÈÈçC:\Program Files\IBM\SQLLIB\java¡£È·¶¨£¬±£´æ¡£
×¢Ò⣺ͨ¹ý¹ÜÀí¹¤¾ß·ÃÎÊÔ¶³Ì»úÆ÷µÄʱºò£¬ÉèÖõÄÊý¾Ý¿âÇý¶¯³ÌÐòjar°ü£¬ÐëΪӦÓ÷þÎñÆ÷ËùÔÚ»úÆ÷µÄλÖ㬶ø²»ÊDZ¾»úÇý¶¯ËùÔÚλÖ㬷ñÔò·þÎñ½«ÎÞ·¨¼ÓÔØÇý¶¯³ÌÐò£¬²âÊÔÊý¾ÝÔ´Á¬½Ó½«Ê§°Ü¡£
3) ´´½¨JDBC Provider
ÔÚµ¼º½À¸×ó²àÑ¡Ôñ: Resources -> JDBC -> JDBC Providers¡£ÔÚÓÒ²àµãNew. ÉèÖÃDatabase typeÑ¡ÔñDB2; Provider type Ñ¡Ôñ DB2 Universal JDBC Driver Provider; Implementation type Ñ¡Ôñ Connection pool data source(ÕâÀïÐèҪעÒâµÄÊÇ£¬·ÇÓ¢ÎÄÓû§¿ÉÄÜ»á³ö´í£¬Ö»Ðè´ò¿ª¿ØÖÆÃæ°å -> ÇøÓòºÍÓïÑÔÑ¡Ïî -> ÇøÓòÑ¡Ïî ÖÐµÄ ±ê×¼ºÍ¸ñʽѡ³ÉÓ¢Óï(ÃÀ¹ú)¼´¿É); Name¿ÉÒÔËæÒâÉèÖÃ; µã»÷Next; Next; Finish; Save¡£
4) ´´½¨Data source
ÔÚµ¼º½À¸×ó²àÑ¡Ôñ: Resources -> JDBC -> Data sources. ÔÚÓÒ²àµãNew. ÉèÖÃData source name; ÉèÖÃJNDI name; Next; Ñ¡Ôñ¸Õ²Åн¨µÄJDBC Provider; Next; Database name Éè³ÉÄãµÄÊý¾Ý¿âÃû; Driver type Ñ¡ 4; Server name Éè³ÉserverµÄip; Port ÉèΪ 50000; Next; Finish; Save.
5) Ñ¡Ôñ¸Õ´´½¨µÄData source, ÔÚRelated ItemsÖÐÅäÖÃJAAS, AliasÉèÖñðÃû; User IDºÍPasswordÉèΪ·
Ïà¹ØÎĵµ£º
Ò»¡¢JavaÖе÷ÓÃservlet˵Ã÷£º
ÎÒÃÇÓÐʱ¿ÉÄÜÐèÒªÔÚJavaÀàÖе÷ÓÃServlet´Ó¶øʵÏÖijЩÌØÊâµÄ¹¦ÄÜ£¬ÔÚJavaAPIÖÐÌṩÁËÒ»¸öURLµÄÀ࣬ÆäÖÐopenStream( )·½·¨¿ÉÒÔ´ò¿ªURLµÄÁ¬½Ó£¬²¢·µ»ØÒ»¸öÓÃÓÚ¸ÃÁ¬½Ó¶ÁÈëµÄInputStream¡£
¶þ¡¢JavaÖе÷ÓÃservletÓ¦ÓþÙÀý£º
package com.solid.test;
import java.io.BufferedReader;
import ja ......
String keyword = request.getParameter("keyword");
String timeRange = request.getParameter("timeRange");
String type = request.getParameter("type");
StringBuffer sql = new StringBuffer();
sql.append("use webstation_leadall s ......
±È½ÏPHPºÍJSPÕâÁ½¸öWeb¿ª·¢¼¼Êõ,ÔÚÄ¿Ç°µÄÇé¿öÊÇÆäʵÊDZȽÏPHPºÍJavaµÄWeb¿ª·¢.ÒÔÏÂÊÇÎҾͼ¸¸öÖ÷Òª·½Ãæ½øÐеıȽÏ:
Ò». ÓïÑԱȽÏ
PHPÊǽâÊÍÖ´ÐеķþÎñÆ÷½Å±¾ÓïÑÔ,Ê×ÏÈphpÓмòµ¥ÈÝÒ×ÉÏÊÖµÄÌصã.Óï·¨ºÍcÓïÑԱȽÏÏó,ËùÒÔѧ¹ýcÓïÑԵij ......
1.¸ÅÊö
JSPÊÇÒ»ÖÖʵÏÖÆÕͨ¾²Ì¬HTMLºÍ¶¯Ì¬HTML»ìºÏ±àÂëµÄ¼¼Êõ¡£
JSP×îÖջᱻת»»³É±ê×¼µÄServlet£¡£¡£¡
JSPÉè¼ÆµÄÄ¿µÄÔÚÓÚ¼ò»¯±íʾ²ãµÄ±íʾ¡£
JSPÒ³ÃæµÄÆäËû³É·ÖÖ÷ÒªÓÐÈçÏÂÈýÖÖ£º
½Å±¾ÔªËØ
Ö¸Áî
¶¯×÷
ÀýÈ磺
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.*& ......
ժѡ×Ô¡¶Java±à³Ì˼Ïë¡·
1£® ¼Ä´æÆ÷£¨register£©¡£ÕâÊÇ×î¿ìµÄ´æ´¢Çø£¬ÒòΪËüλÓÚ²»Í¬ÓÚÆäËû´æ´¢ÇøµÄµØ·½——´¦ÀíÆ÷ÄÚ²¿¡£µ«ÊǼĴæÆ÷µÄÊýÁ¿¼«ÆäÓÐÏÞ£¬ËùÒԼĴæÆ÷ÓɱàÒëÆ÷¸ù¾ÝÐèÇó½øÐзÖÅä¡£Äã²»ÄÜÖ±½Ó¿ØÖÆ£¬Ò²²»ÄÜÔÚ³ÌÐòÖиоõµ½¼Ä´æÆ÷´æÔÚµÄÈκμ£Ïó¡£
2£®¶ÑÕ»£¨stack£©¡£Î»ÓÚͨÓÃRAM£¨random-access memory£¬ ......