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

Hibernate MySQL ÖÐÎÄÂÒÂëÎÊÌâ


Hibernate MySQL ÖÐÎÄÂÒÂëÎÊÌâ
»·¾³£ºHibernate 2.1.7 + MySQL4.1£¨MySQLµÄ±àÂëÒÑÉèÖÃΪutf8£©
ÎÊÌ⣺ͨ¹ýHibernateÏòMySQLдÈëÖÐÎĺó£¬Í¨¹ýHibernateÈ¡»ØÊý¾Ý£¬ÔÚconsoleÖдòÓ¡java¶ÔÏóÏÔʾÕý³£¡£µ«ÔÚMySQL Query BrowserÖп´µ½µÄÊÇÂÒÂ룬´«¸øÇ°¶ËµÄFlexÒ²ÊÇÂÒÂë¡£
Ô­Òò£ºHibernateµÄ»ù´¡»¹ÊÇJDBC£¬ËùÒÔÒ»ÑùÐèÒªÉèÖÃcharacterEncoding£¡
½â¾ö·½·¨£º
ÔÚhibernate.cfg.xmlÖÐÓ¦¸ÃÕâÑùд
<property name="connection.url">jdbc:mysql://localhost:3306/test?useUnicode=true&amp;characterEncoding=UTF-8</property>
Èç¹ûÓÃhibernate.properties
#hibernate.connection.url jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8
ps£º´¦ÀíÖÐÎĵĻ°£¬characterEncodingÓÃGBKÒ»Ñù¿ÉÒÔ¡£
µ«×Ö½Ú±àÂëÎÊÌâ×îºÃµÄ½â¾ö·½·¨»¹ÊÇͳһʹÓÃUTF-8£¡£¡£¡
posted on 2005-06-10 21:35 °åÇÅ¾Ó ÔĶÁ(140) ÆÀÂÛ(0)  ±à¼­ ÊÕ²Ø
ÁíÍâÒ»¸öblog»¹ÓÐÏêϸµÄÈýÖÖ½â¾ö·½·¨£ºhttp://www.cnblogs.com/josson/
Hibernate+mysql ÖÐÎÄÎÊÌâ½â¾ö·½°¸.
1, mysql°²×°Ê±ÉèÖÃ×Ö·û¼¯utf-8, jdbcÇý¶¯3.0.15ÒÔÉÏ.
2. hibernateÅäÖÃÎļþÖÐ,¼ÓÉÏÊôÐÔ
<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">UTF-8</property>
3. web.xmlÉèÖÃFilter
=================================================
<filter>
  <filter-name>
   Set Web Application Character Encoding
  </filter-name>
  <filter-class>cn.com.commnet.util.SetEncodeFilter</filter-class>
  <init-param>
   <param-name>defaultencoding</param-name>
   <param-value>UTF-8</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>
   Set Web Application Character Encoding
  </filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
=================


Ïà¹ØÎĵµ£º

mysql ×ÔÔöÁÐÏà¹ØÎÊÌâÕûÀí

MYSQL×ÔÔöÁÐ
1.¹Ø¼ü×Ö £ºauto_increment
2.×ÔÔöÓ÷¨
Àý:
CREATE TABLE animals ( id mediumint not null auto_increment,
name char(30) not null,
primary key (id));
3.¹ØÓÚ×ÔÔö
Q:Ôõô»ñµÃµ±Ç°µÄ×ÔÔöµÄ×î´óÖµ?
A:select @@identity
Q:Ôõô»ñµÃtableµÄµ±Ç°×ÔÔö×î´óÖµ?
A:select max(id) from table ......

MYSQLÒѾ­ÉúЧµÄÉèÖúÍ״̬²éѯÃüÁî

ÒÔÏÂÃüÁî¿ÉÒÔÔÚÈκÎÒѾ­Á¬½ÓÉÏMYSQL·þÎñÆ÷µÄ¿Í»§¶ËÉÏÖ´ÐС£
show full processlist ;
kill 57725;#ɱµôÉÏÃæ²éµ½µÄij¸öµ¼ÖÂ×èÈûµÄÁ¬½Ó
SELECT @@profiling;
SET profiling = 1;
SHOW PROFILES;
SHOW PROFILE for QUERY 1;
#ϵͳÉèÖÃ
show variables like '%key%';
show variables like '%key%';
show variables l ......

LinuxÏÂMySQL5.1µÄ°²×°

×î½üÏëÔÚ·þÎñÆ÷ÉÏÊÔÊÔMySQL5.1µÄ·ÖÇø£¬ÓÚÊǾÍÏë×Å×°¸öMySQL5.1£¬¾­¹ýÍ´¿àµÄÒ»¶Î¾­Àúºó£¬ÖÕÓÚÕÒ¸öÏÂÃæ×°¸öºÜºÃµÄ½Ì³Ì£¬ÌûÉÏÀ´±¸Íü¡£
1¡¢MySQLÃâ°²×°°æ/¶þ½øÖÆ°æÈí¼þ£¬²»ÓñàÒ룬ÏÂÔصØÖ·£º
     http://dev.mysql.com/downloads/
     Îļþ¸ñʽ£ºMYSQL-VERSION-OS.tar.gz
2¡¢´ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ