¡¾×ª¡¿²ÉÓÃp6spyÍêÕûÏÔʾhibernateµÄSQLÓï¾ä
×÷ÕߣºÇñÑó
QQ£º1964477
ËäÈ»ÔÚhibernateÖÐÓÐshow_sqlÑ¡Ïµ«ÊÇÏÔʾ³öÀ´µÄÓï¾ä´ó¶àÀàËÆ
select * from xxx where value=?
µ«ÊÇÓÐʱºòÎÒÃÇÐèÒªµÃµ½ÍêÕûµÄSQLÓï¾ä£¬Ôõô°ìÄØ£¿Ê¹ÓÃP6SPY¾Í¿ÉÒÔÍê³ÉÕâ¸öÈÎÎñ
p6spyÊÇÒ»¸ö¿ªÔ´Èí¼þ£¬Ëü¿ÉÒÔ¸ú×ÙÈκÎʹÓÃjdbcµÄÓ¦ÓòúÉúµÄÊý¾Ý¿â²Ù×÷¡£ÌرðÊʺÏÓÚ¼à¿Øejb·þÎñÆ÷²úÉúµÄ sql statements¡£
¹Ù·½ÍøÖ·£ºhttp://www.p6spy.com/
Ä¿Ç°p6spy ÊÊÓõÄÓ¦Ó÷þÎñÆ÷°üÀ¨jboss, atg, orion, jonas, iplanet, weblogic, websphere, resin and tomcat.
ÏÂÃæÎÒ½éÉÜÒ»ÏÂp6spyÔÚtomcatÓ¦ÓóÌÐòÉÏ°²×°µÄ²½Ö裺
£¨1£©http://www.p6spy.com/download.html£¬ÏÂÔØzip°ü
£¨2£©½âѹ³öp6spy.jar spy.propertiesÁ½¸öÎļþ
£¨3£©½«p6spy.jar ·ÅÈëÓ¦ÓóÌÐòµÄWEB-INF/libĿ¼£¬½«spy.properties·ÅÈëWEB-INF/classesĿ¼
£¨4£©ÐÞ¸Äspy.properties
realdriver =com.mysql.jdbc.Driver ½«ÕâÐÐÇ°ÃæµÄ#È¥µô
logfile = c:/spy.log ÐÞ¸ÄÒ»¸öÄãÐèÒªµÄÈÕÖ¾ÎļþÃû
£¨5£©ÐÞ¸Ähibernate.xml£¬ÐÞ¸Äconnection.driver_classµÄֵΪcom.p6spy.engine.spy.P6SpyDriver
£¨6£©ÖØÆôtomcat
£¨7£©ÕâÑùÔÚc:/ϵÄspy.log¼Ç¼ÁËÊý¾Ý¿âµÄ·ÃÎÊÇé¿ö¡£
ÔÎĵØÖ·£ºhttp://www.blogjava.net/qclass/archive/2006/08/21/64692.html
Ïà¹ØÎĵµ£º
char¡¢varchar¡¢textºÍnchar¡¢nvarchar¡¢ntext
charºÍvarcharµÄ³¤¶È¶¼ÔÚ1µ½8000Ö®¼ä£¬ËüÃǵÄÇø±ðÔÚÓÚcharÊǶ¨³¤×Ö·ûÊý¾Ý£¬¶øvarcharÊDZ䳤×Ö·ûÊý¾Ý¡£Ëùν¶¨³¤¾ÍÊdz¤¶È¹Ì¶¨
µÄ£¬µ±ÊäÈëµÄÊý¾Ý³¤¶ÈûÓдﵽָ¶¨µÄ³¤¶Èʱ½«×Ô¶¯ÒÔÓ¢ÎÄ¿Õ¸ñÔÚÆäºóÃæÌî³ä£¬Ê¹³¤¶È´ïµ½ÏàÓ¦µÄ³¤¶È£»¶ø±ä ......
ÔÚ½éÉÜGROUP BY ºÍ HAVING ×Ó¾äÇ°£¬ÎÒÃDZØÐèÏȽ²½²sqlÓïÑÔÖÐÒ»ÖÖÌØÊâµÄº¯Êý£º¾ÛºÏº¯Êý£¬ÀýÈçSUM, COUNT, MAX, AVGµÈ¡£ÕâЩº¯ÊýºÍÆäËüº¯ÊýµÄ¸ù±¾Çø±ð¾ÍÊÇËüÃÇÒ»°ã×÷ÓÃÔÚ¶àÌõ¼Ç¼ÉÏ¡£
SELECT SUM(population) from bbc
¡¡¡¡ÕâÀïµÄSUM×÷ÓÃÔÚËùÓзµ»Ø¼Ç¼µÄpopulation×Ö¶ÎÉÏ£¬½á¹û¾ÍÊǸòéѯֻ·µ»ØÒ»¸ö½á¹û£¬¼´ËùÓйú¼ÒµÄ× ......
SQL Server 2005 Express µ¼Èë/µ¼³öÊý¾Ý
°²×°ºÃSQL Server 2005 Expressºó£¬ÔÙ°²×°
http://download.microsoft.com/download/1/1/0/110d908f-c445-4523-b939-220c7d135f3d/SQLServer2005_SSMSEE.msi
¾Í¿ÉÒÔʹÓÿØÖÆ̨½øÐÐÊý¾Ý¿âµÄ¹ÜÀí¡£
µ«SQL Server Management Studio Express ²¢Ã»Óе¼Èë/µ¼³öÊý¾ÝµÄ¹¦ÄÜ£¬ÎÒÃÇ¿ÉÒÔ ......
distinctÕâ¸ö¹Ø¼ü×ÖÓÃÀ´¹ýÂ˵ô¶àÓàµÄÖظ´¼Ç¼ֻ±£ÁôÒ»Ìõ£¬µ«ÍùÍùÖ»ÓÃËüÀ´·µ»Ø²»Öظ´¼Ç¼µÄÌõÊý£¬¶ø²»ÊÇÓÃËüÀ´·µ»Ø²»ÖؼǼµÄËùÓÐÖµ¡£ÆäÔÒòÊÇdistinctÖ»ÓÐÓöþÖØÑ»·²éѯÀ´½â¾ö£¬¶øÕâÑù¶ÔÓÚÒ»¸öÊý¾ÝÁ¿·Ç³£´óµÄÕ¾À´Ëµ£¬ÎÞÒÉÊÇ»áÖ±½ÓÓ°Ï쵽ЧÂʵġ£
ÏÂÃæÏÈÀ´¿´¿´Àý×Ó£º
table±í
×Ö¶Î1 ×Ö¶ ......
SQL°æ£º
alter proc testguo
(
@cityid int,
@cityname nvarchar(100) output
)
as
select @cityname = city_name from BA_Hot_City where cityid = @cityid
select @cityname
go
declare @cityname nvarchar(100)
exec testguo 1,@cityname output
ÁíÒ»°æ£º
ht ......