(mysql)´æ´¢¹ý³Ì
(1)
´æ´¢¹ý³ÌÊÇÊý¾Ý¿â·þÎñÆ÷¶ËµÄÒ»¶Î³ÌÐò.
mysqlµÄ´æ´¢¹ý³Ì,Ö»Óа汾ÊÇmysql5.0»òÒÔÉϵIJÅÓдËÌØÐÔ.
(2)
ʲôʱºòÐèÒªÓô洢¹ý³Ì
´æ´¢¹ý³Ìͨ³£ÊÇһЩ¾³£ÒªÖ´ÐеÄÈÎÎñ£¬ÕâЩÈÎÎñÍùÍùÊÇÕë¶Ô´óÁ¿µÄ¼Ç¼¶ø½øÐеġ£ÔÚ·þÎñÆ÷ÉÏÖ´Ðд洢¹ý³Ì£¬¿ÉÒÔ
¸ÄÉÆÓ¦ÓóÌÐòµÄÐÔÄÜ¡£ÕâÊÇÒòΪ£º
2.1.
·þÎñÆ÷ÍùÍù¾ßÓÐÇ¿´óµÄ¼ÆËãÄÜÁ¦ºÍËٶȡ£
2.2
±ÜÃâ°Ñ´óÁ¿µÄÊý¾ÝÏÂÔص½¿Í»§¶Ë£¬¼õÉÙÍøÂçÉϵĴ«ÊäÁ¿¡£
2.3
´æ´¢¹ý³ÌÖ»ÔÚ´´Ôìʱ½øÐбàÒ룬ÒÔºóÿ´ÎÖ´Ðд洢¹ý³Ì¶¼²»ÐèÔÙÖØбàÒ룬¶øÒ»°ãSQLÓï¾äÿִÐÐÒ»´Î¾Í±àÒëÒ»´Î,Ëù
ÒÔʹÓô洢¹ý³Ì¿ÉÌá¸ßÊý¾Ý¿âÖ´ÐÐËٶȡ£
2.4
´æ´¢¹ý³Ì¿ÉÒÔÖظ´Ê¹ÓÃ,¿É¼õÉÙÊý¾Ý¿â¿ª·¢ÈËÔ±µÄ¹¤×÷Á¿
2.5
°²È«ÐÔ¸ß,¿ÉÉ趨ֻÓÐij´ËÓû§²Å¾ßÓжÔÖ¸¶¨´æ´¢¹ý³ÌµÄʹÓÃȨ
(3)
3.1
ʹÓô洢¹ý³Ì֮ǰ,Ðë»»Ò»ÖÖ·Ö¸ô·û.ÒòΪÔÚ´æ´¢¹ý³ÌÖÐ,´æÔÚ¶à¸öSQLÓï¾ä,ËùÓÐÐëÓÃÁíÒ»¸ö·Ö¸ô·ûÀ´±íʾ½áÊø·ûºÅ.
·Ö¸ô·û: --->Ö»¶Ôµ±Ç°Á¬½ÓÓÐЧ.Ï´ÎÁ¬½Óʱ,ÈÔÒÔ";"Ϊ·Ö¸ô·û.
DELIMITER //
ÓûØÔÀ´µÄ";",¿ÉÒÔÓÃ: delimiter ;
3.2
µÚ¶þ²¿·ÖÊǹý³ÌÃû£¬ºÏ·¨±êʶ·ûµÄÎÊÌâ:
´æ´¢¹ý³ÌÃû¶Ô´óСд²»Ãô¸Ð£¬Òò´Ë‘P1’ºÍ‘p1’ÊÇͬһ¸öÃû×Ö£¬ÔÚͬһ¸öÊý¾Ý¿âÖÐÄ㽫ÄܸøÁ½¸ö´æ´¢¹ý³ÌÈ¡ÏàͬµÄ
Ãû×Ö£¬ÒòΪÕâÑù½«»áµ¼ÖÂÖØÔØ¡£Ä³Ð©DBMSÔÊÐíÖØÔØ£¨OracleÖ§³Ö£©£¬µ«ÊÇMySQL²»Ö§³Ö¡£
Äã¿ÉÒÔ²ÉÈ¡“Êý¾Ý¿âÃû.´æ´¢¹ý³ÌÃû”ÕâÑùµÄÕÛÖз½·¨£¬Èç“db5.p1”¡£
(4)
4.1
´´½¨´æ´¢¹ý³Ìʱ£¬ÏÈÓÃÑ¡ÔñÏàÓ¦µÄÊý¾Ý¿â¡£ÒòΪ´´½¨µÄ´æ´¢¹ý³ÌÊÇÊôÓÚijһÊý¾Ý¿âµÄ¡£
4.2
µ÷Óô洢¹ý³Ì:
»ù±¾Óï·¨£ºcall sp_name()
×¢Ò⣺´æ´¢¹ý³ÌÃû³ÆºóÃæ±ØÐë¼ÓÀ¨ºÅ£¬ÄÄŸô洢¹ý³ÌûÓвÎÊý´«µÝ
ÈçÏÂ:
call p1 () //
4.3
ɾ³ý´æ´¢¹ý³Ì
1.»ù±¾Óï·¨£º
drop procedure sp_name//
×¢ÒâÊÂÏî:
²»ÄÜÔÚÒ»¸ö´æ´¢¹ý³ÌÖÐɾ³ýÁíÒ»¸ö´æ´¢¹ý³Ì£¬Ö»Äܵ÷ÓÃÁíÒ»¸ö´æ´¢¹ý³Ì
4.4
´æ´¢¹ý³ÌµÄ²é¿´:
1)
ÏÔʾµ±Ç°Êý¾Ý¿â´æ´¢¹ý³Ì:
show procedure status//
»áÏÔʾÊý¾Ý¿âÖÐËùÓеĴ洢¹ý³ÌµÄËùÊôÊý¾Ý¿â,´æ´¢¹ý³ÌÃû,ÀàÐÍ(type),¶¨ÒåÕß(Èç:root@localhost),´´½¨Ê±¼ä,ÐÞ¸Ä
ʱ¼äµÈ.
2)
show create procedure sp_name
ÏÔʾijһ¸ö´æ´¢¹ý³ÌµÄÏêϸÐÅÏ¢
3)
Ò²¿ÉÓÃ:
select body from mysql.proc where name="¹ý³ÌÃû";
(5)
×÷ÓÃÓò:
CREATE PROCEDURE p11 ()
BEGIN
DECLARE x1 CHAR(5) DEFAULT 'outer'; -- ²ÉÓÃÁËĬÈÏ×Ó
Ïà¹ØÎĵµ£º
¸÷λ¸ßÊֺá£Ð¡µÜѧϰJAVA²»¾Ã£¬È»ºóÔÙÓÃMYSQLÊý¾Ý¿â¡£
ÓÉÓÚÊÇÓñðÈ˵ĵķ¶Àýѧϰ£¬ËùÒÔ³öÏֺܶàÆæ¹ÖµÄÎÊÌâ
ÎÒÓÃ×Ô¼ºµÄMYSQL ·þÎñÆ÷£¬È»ºó°Ñ±ðÈ˵ÄÊý¾Ý¿âµ¼½øÀ´¡£È»ºó³öÏÖ°æ±¾ÎÊÌâ¡£
ÎÊÌâÈçÏÂ
Table './db_librarysys/tb_manager' was created with a different version of MySQL and cannot be read
2010-4-28 22:44 ......
×î½üÓÃmysqlдÁ˼¸¸ö¸´ÔÓµÄÓï¾ä£¬¸Ð¾õÔÚ¹ØϵºÜ¸´ÔÓµÄʱºòÏÈÀíÇå¹ØϵÔÙÑ¡ÔñÓõIJéѯ·½·¨ÊǺÜÖØÒªµÄ£¬ÒòΪͬһ¸öÐèÇó¿ÉÄÜÓò»Í¬µÄ·½·¨À´²é³öÀ´£¬µ«ÊǸ´ÔӶȣ¬ÐÔÄܶ¼²»Ò»Ñù¡£
ÏÂÃæ˵һÏÂÄÜʵÏÖ¸´ÔÓ²éѯµÄһЩһ°ã·½·¨£º
Ò».withÓï·¨£¨Ê×ÏÈ˵Ã÷£¬ºÃÏñMysql²»Ö§³ÖÕâ¸öÓï ......
[תÌûÍøÖ·]http://java-2007.javaeye.com/blog/622269
Íü¼ÇMySQL(ºÍPHP´îÅäÖ®×î¼Ñ×éºÏ) ROOTÃÜÂëÊÇÔÚMySQL(ºÍPHP´îÅäÖ®×î¼Ñ×éºÏ)ʹÓÃÖкܳ£¼ûµÄÎÊÌ⣬¿ÉÊÇÓкܶàÅóÓѲ¢²»»áÖØÖÃROOTÃÜÂ룬Äǽпడ£¬ÎÒÓÐÉîÓид¥£¬ÌØд´ËÎÄÕÂÓë´ó¼Ò½»Á÷£º
1¡¢±à¼MySQL(ºÍPHP´îÅäÖ®×î¼Ñ×éºÏ)ÅäÖÃÎļþ£º
windows»·¾³ÖУº%MySQL(ºÍPHP´îÅäÖ ......
ÕâÀïÊÇʹÓÃODBCÀ´×ª»»Êý¾Ý¿âµÄ¡£
1.°²×°mysqlÊý¾Ý¿âµÄODBCÇý¶¯£¬mysql¹ÙÍøÓÐÏÂÔØhttp://dev.mysql.com/downloads/connector/odbc/
2.´ò¿ª¿ØÖÆÃæ°å\¹ÜÀí¹¤¾ß\Êý¾ÝÔ´ODBC£¬ÔÚÓû§DSNÖÐÌí¼ÓÒ»¸öMySQL ODBC Êý¾ÝÔ´¡£
3.½Ó×ÅÔÚÏÂÃæµÄ´°ÌåÖÐÊäÈëÊý¾ÝÔ´Ãû³Æ£¬Èçmysqlodbc£»È»ºóÊäÈë·þÎñÆ÷ServerµØÖ·£¨localhost»òÆäËû£©£¬Óû§Us ......
ÎÒд¹ýµÄ½Ì³Ì²»¶à£¬¶øÇҴ󲿷ֶ¼ÊÇÀ´Ô´ÓÚ±ðÈ˵Ľ̳̣¬²»¹ý£¬ÕâÀïËù½éÉܵģ¬¶¼ÊÇÈÚÈëÎÒËù×ܽáµÄ¾Ñ飮££ÒýÑÔ
¡¡¡¡
¡¡¡¡PHPµÄÖ´ÐÐЧÂÊÊÇÓÐÄ¿¹²¶ÃµÄ£¬ÕâÒ²ÊÇÎÒϲ»¶ËüµÄÔÒòÖ®Ò»£¬ºÍËü³ÆΪ¾øÃî´îµµµÄMysqlÒÔ¼°ApacheÏëÈںϣ¬²»Äܲ»¾ªÌ¾ÆäЧÂÊÁË¡£PHP¸üÐÂÒ²ºÜ¿ì£¬ÕâÀïÁоÙÁËÄ¿Ç°×îа汾PHP4.3.2RC4£¨¼¸ºõûÓÐBUGÁË£¬¹À¼ÆÐ´Í ......