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

jspÁ¬½ÓMySQLÊý¾Ý¿â 2

¡ñjspÁ¬½ÓMySQLÊý¾Ý¿â
testmysql.jspÈçÏ£º
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url ="jdbc:mysql://localhost/softforum?
user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1"
//testDBΪÄãµÄÊý¾Ý¿âÃû
Connection conn= DriverManager.getConnection(url);
Statement stmt=conn.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from test";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
ÄúµÄµÚÒ»¸ö×Ö¶ÎÄÚÈÝΪ£º<%=rs.getString(1)%>
ÄúµÄµÚ¶þ¸ö×Ö¶ÎÄÚÈÝΪ£º<%=rs.getString(2)%>
<%}%>
<%out.print("Êý¾Ý¿â²Ù×÷³É¹¦£¬¹§Ï²Äã");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>


Ïà¹ØÎĵµ£º

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%'; #Ö´ÐбàÂëÏ ......

ÔÚjspÒ³Ãæ¼ä´«µÝ²ÎÊý

£¨1£©Ö±½ÓÔÚURLÇëÇóºóÌí¼Ó
¡¡¡¡ È磺<a href="thexuan.jsp?action=transparams&detail=directe")Ö±½Ó´«µÝ²ÎÊý/a> 
¡¡¡¡ ÌرðµÄÔÚʹÓÃresponse.sendRedirect×öÒ³ÃæתÏòµÄʱºò£¬Ò²¿ÉÒÔÓÃÈçÏ´úÂ룺
¡¡¡¡ response.sendRedirect("thexuan.jsp?action=transparams&de ......

jspÖÐÁ¬½ÓÊý¾Ý¿âµÄÎÊÌâ

½ñÌìÔÚѧϰjspÖÐÊý¾Ý¿âµÄʹÓÃʱ£¬Óöµ½Ò»¸öºÜÆæ¹ÖµÄÇé¿ö£¨ÖÁÉÙÏÖÔÚ¿´À´Êǵģ©¡£jspÖÐÁ¬½ÓmysqlÊý¾Ý¿â£¬¿ªÆômysqlÊý¾Ý¿âºó£¬ÔÚjspÒ³ÃæÖÐǶÈëµÄjavaÁ¬½ÓmysqlÊý¾Ý¿âµÄÄǼ¸¾ä´úÂë¡£ºÃÏñ Class.forName("org.gjt.mm.mysql.Driver");ûÆðµ½×÷Óã¬Ö»ÐèÒªConnection con=DriverManager.getConnection("jdbc:mysql://localhost/test? ......

MySQLË÷ÒýÓÅ»¯

Ò»¡¢Ê²Ã´ÊÇË÷Òý£¿
Ë÷ÒýÓÃÀ´¿ìËÙµØÑ°ÕÒÄÇЩ¾ßÓÐÌض¨ÖµµÄ¼Ç¼£¬ËùÓÐMySQLË÷Òý¶¼ÒÔB-Ê÷µÄÐÎʽ±£´æ¡£Èç¹ûûÓÐË÷Òý£¬Ö´ÐвéѯʱMySQL±ØÐë´ÓµÚÒ»¸ö¼Ç¼¿ªÊ¼É¨ÃèÕû¸ö±íµÄËùÓмǼ£¬Ö±ÖÁÕÒµ½·ûºÏÒªÇóµÄ¼Ç¼¡£±íÀïÃæµÄ¼Ç¼ÊýÁ¿Ô½¶à£¬Õâ¸ö²Ù×÷µÄ´ú¼Û¾ÍÔ½¸ß¡£Èç¹û×÷ΪËÑË÷Ìõ¼þµÄÁÐÉÏÒѾ­´´½¨ÁËË÷Òý£¬MySQLÎÞÐèɨÃèÈκμǼ¼´¿ÉѸËٵõ ......

MySQL 5.0´æ´¢¹ý³Ì±à³ÌÈëÃÅ

Ê×ÏÈ¿´MySQL 5.0²Î¿¼ÊÖ²áÖйØÓÚ´´½¨´æ´¢¹ý³ÌµÄÓ﷨˵Ã÷£º
CREATE
    [DEFINER = { user | CURRENT_USER }]
    PROCEDURE sp_name ([proc_parameter[,...]])
    [characteristic ...] routine_body
   
proc_parameter:
    [ IN | ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ