Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JSPÁ¬½ÓMySQLÊý¾Ý¿â

JSPÁ¬½ÓMySQLÊý¾Ý¿â
2007-04-04 19:30
Ò»¡¢ÎªTomcat°²×°Mysql£¨´ËÀýÖÐmySQL°æ±¾ÊÇ5.0£©µÄÇý¶¯¡£µ½mySQLµÄ¹Ù·½ÍøÕ¾ÏÂÔØ£¬È»ºó½âѹµ½Apache Tomcat5.0 webapps\root\web-inf\classesÎļþ¼ÐÏ£¬ÈçÏÂͼ£º
¡¡¡¡Õâʱ¾Í¿ÉÒÔÓÃJSP±àд·ÃÎÊmySQLµÄ´úÂëÁË¡£ÎÒÃÇÏÈÔÚmySQLϽ¨Á¢Ò»¸öÊý¾Ý¿â¡£Èçϵã»÷¿ªÊ¼²Ëµ¥ÔÚÃüÁîÐÐÏÂÔËÐÐmySQL¡£(Ò²¿ÉÒÔÏÂÔØÒ»¸öµÚÈý·½µÄͼÐνçÃæÏ¹ÜÀímySQLµÄÈí¼þ¡£)
¡¡¡¡ÔÚÏÂÃæÔÚÃüÁîÐУ¬½¨Á¢Ò»¸öÊý¾Ý¿â£¬ÏȽ¨Á¢Ò»¸öÃû×ÖΪFirstµÄÊý¾Ý¿â£¬È»ºó£¬ÔÚÆäÊý¾Ý¿âϽ¨Á¢txlÕâ¸ö±í£¬ÈçÏÂͼ£º¡¡
¡¡
¡¡È»ºó£¬ÔÚtxlÕâ¸ö±íÖвåÈëÊý¾Ý£¬ÈçÏÂͼ£º
¡¡¡¡Ö®ºó£¬ÎÒÃÇÓÃselectÓï¾ä½øÐвéѯ£¬¿´¿´±íÖеÄÊý¾Ý£¬ÈçÏÂͼ£º
¡¡¡¡¿ªÊ¼±àдÁ¬½ÓÊý¾Ý¿âµÄJSP´úÂ룺
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page language="java" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<HTML>
<HEAD>
   <TITLE>jspÁ¬½Ómysql</TITLE>
</HEAD>
<BODY>
<h2 align="center">JSPÁ¬½ÓmySQL</h2>
<%
    Connection con;
    Statement stmt;
    ResultSet rs;
    Class.forName("com.mysql.jdbc.Driver");
    DriverManager.registerDriver(new com.mysql.jdbc.Driver());
    String DbConn = "jdbc:mysql://localhost:3306/first";
    String DbPass="123";
    con = java.sql.DriverManager.getConnection(DbConn,"root",DbPass);
    stmt = con.createStatement();
    rs = stmt.executeQuery("select * from txl");
    out.println("<table border='1' cellspacing='0' cellpadding='0'>");
    out.println("<tr><td>ÐÕÃû</td><td>ÐÔ±ð</td><td>µç×ÓÓʼþ</td><td>µç»°</td><td>µØÖ·</td></tr>");
    while(rs.next())
    {
     String userid = rs.getString(1);
     String sex = rs.getString(2);
     String email =


Ïà¹ØÎĵµ£º

Solaris10ÏÂmysqlµÄ±àÂëÎÊÌâ

°²×°ºó
/etc/init.d/mysql start (stop) ΪÆô¶¯ºÍÍ£Ö¹·þÎñÆ÷
/etc/mysql/ Ö÷ÒªÅäÖÃÎļþËùÔÚλÖà my.cnf
/var/lib/mysql/ ·ÅÖõÄÊÇÊý¾Ý¿â±íÎļþ¼Ð£¬ÕâÀïµÄmysqlÏ൱ÓÚwindowsÏÂmysqlµÄdateÎļþ¼Ð
Æô¶¯mysqlºó£¬ÒÔrootµÇ¼mysql
isher@isher-ubuntu:~$ mysql -u root
>show variables like 'character%'; #Ö´ÐбàÂëÏ ......

¹ØÓÚmysqlÖеÄint£¨m£©


<!--
/* Font Definitions */
@font-face
{font-family:ËÎÌå;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@ËÎÌå" ......

²é¿´ MySql ×Ö·û¼¯

MySQL ÂÒÂëµÄ¸ùÔ´ÊÇµÄ MySQL ×Ö·û¼¯ÉèÖò»µ±µÄÎÊÌ⣬±¾ÎÄ»ã×ÜÁËÓйز鿴 MySQL ×Ö·û¼¯µÄÃüÁî¡£°üÀ¨²é¿´ MySQL Êý¾Ý¿â·þÎñÆ÷×Ö·û¼¯¡¢²é¿´ MySQL Êý¾Ý¿â×Ö·û¼¯£¬ÒÔ¼°Êý¾Ý±íºÍ×ֶεÄ×Ö·û¼¯¡¢µ±Ç°°²×°µÄ MySQL ËùÖ§³ÖµÄ×Ö·û¼¯µÈ¡£
Ò»¡¢²é¿´ MySQL Êý¾Ý¿â·þÎñÆ÷ºÍÊý¾Ý¿â×Ö·û¼¯¡£
mysql> show variables like '%char%';
+-- ......

Mysql Explain Ïê½â[Ç¿ÁÒÍÆ¼ö]

Mysql Explain Ïê½â
Ò».Óï·¨
explain < table_name >
ÀýÈç: explain select * from t3 where id=3952602;
¶þ.explainÊä³ö½âÊÍ
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+
| id | select_type | table | type  | possible_keys  &nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ