mysqlÁ¬½Ótomcat - Java / Web ¿ª·¢
ÎÒÒѾ°´Õս̳ÌÉÏÅäÖÃtomcatµÄserver.xml
<Context path = "/POS" docBase = "POS" debug = "5" reloadable = "true" crossContext = "true" workDir = "">
<Resource name = "jdbc/pos" auth = "Container" type = "javax.sql.DataSource" maxActive = "100" maxIdle ="30" maxWait = "10000"
username = "root" password = "rarzyz" driverClassName = "org.gjt.mm.mysql.Driver" url = "jdbc:mysql:// localhost/test"/>
</Context>
Ò²°Ñ½Ì³Ì¹âÅÌÉϵÄweb.xmlºÍappcontext.xml¶¼¸´ÖÆÈ¥ÁË¡£µ«ÊÇ»¹ÊÇÔÚ°´Ìá½»µÇ½µÄÓû§ÃûºÍÃÜÂëÒ³Ãæºó£¬ÏÔʾhttp status 500 The server encountered an internal error () that prevented it from fulfilling this request.
org.hibernate.exception.GenericJDBCException: Cannot open connection
Õâ¸ö²»ÄÜ´ò¿ªÁ¬½ÓÌáʾ£¬ÊDz»ÊÇÌáʾÎҵijö´íÁË°¡¡£ÎÒ¿´¹ýtomcatºÍmysql·þÎñÎÒ¶¼¿ªÁË¡£ÓôÃÆ°¡¡£Çý¶¯ÎÒÒ²¿¼µ½libÀïÃæÁË¡£ÊµÔÚ²»ÖªµÀ´íÎóÔÚÄÄÀïÁË
òËÆÕâÁ½¸ö¶¼ÓÐÎÊÌ⣺
driverClassName = "org.gjt.mm.mysql.Driver" url = "jdbc:mysql:// localhost/test"/>
Çý¶¯Ãû²»¶Ô£¬urlÉÙÁ˶˿ںš£¡£¡£
public static String driver="com.mysql.jdbc.Driver"
public static String url="jdbc:mysql://localhost/mydata?user=Óû§Ãû&password=ÃÜÂë"
¿ÉÒÔ²»Òª¶Ë¿ÚºÅ
Ïà¹ØÎÊ´ð£º
ÎÒµÄjava applet ǶÈëhtmlºóÎÞ·¨ÏÔʾ£¬¶øÓÃappletviewerÏÔʾÕý³£ÎªÊ²Ã´£¬»¹ÓоÍÊÇÓÃhtml converterת»¯ºó¿ÉÒÔÏÔʾ£¬ÎªÊ²Ã´£¿Çë´óÏÀ´Í½Ì£¡
HTML code:
<HTML>
<HEAD>
<TITLE>TEST.HTML< ......
ÎÒÏëÓÃJavaдһ¸ö³ÌÐò£¬¾ÍÊÇÎÒÏëÔÚÔËÐдúÂëºó£¬ÔÚÖ¸¶¨µÄʱ¼ä´ò¿ªÄ³³ÌÐò£¬ÀýÈçÎÒÔËÐдúÂëºó£¬½²ÔÚ12£º00´ò¿ª"D:\Program Files\Tencent\QQ2009\Bin\QQ.exe"Õâ¸ö³ÌÐò£¬Çó¸ßÈËÖ¸µã¡£»¹ÓпÉÄܵĻ°ÔÚÖ¸¶¨µÄʱ¼ä ......
import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class QueryTest&n ......
ÎÊÌâÊÇÕâÑùµÄ£º
ÎÒÓÐÒ»¸öÎļþnagiv.jsp ÁíÒ»¸öÎļþfailure.jsp°üº¬Ëû£¬Í¬Ê±nagivÎļþÖÐÓÐÒ»¸ö¿ÉÒÔÌøתµ½yy.jspµÄcommandButton£¬µ«ÊÇÎÒ½«failureÖеã»÷nagivÖеÄÄĸöcommandButton£¬Ò²Ãæ²»»áÌøת ......
ÄÄλÀÏ´óÓбȽϺõķÖÒ³¿Ø¼þ»òÕß´úÂë!
ÒªÇó ¿ÉÒÔÏÔʾ×ÜÒ³Êý.»ù±¾µÄÉÏÏ·ҳ.
Êý¾Ý¿âΪOracle
±íÊý¾ÝÁ¿ÓÐ300Íò×óÓÒ ËùÒÔÏÖÔÚÎҵķÖҳЧÂÊÌ«ÂýÁË.
Ï£ÍûÀÏ´óÃÇÄÜÌṩ¸ü¿ ......