日本中文字幕在线一区,日韩一区二区三区高清,亚洲欧美中文日韩在线v日本http://www.aygfsteel.com/freefly/category/27351.html一門技術(shù),如果不能講出來,那么就是沒有理解,如果不能很好的講出來,那么就是理解不夠透徹!zh-cnThu, 15 Nov 2007 17:34:25 GMTThu, 15 Nov 2007 17:34:25 GMT60growing in depressed moodhttp://www.aygfsteel.com/freefly/archive/2006/04/11/40435.htmlfreeflyfreeflyTue, 11 Apr 2006 04:41:00 GMThttp://www.aygfsteel.com/freefly/archive/2006/04/11/40435.htmlhttp://www.aygfsteel.com/freefly/comments/40435.htmlhttp://www.aygfsteel.com/freefly/archive/2006/04/11/40435.html#Feedback0http://www.aygfsteel.com/freefly/comments/commentRss/40435.htmlhttp://www.aygfsteel.com/freefly/services/trackbacks/40435.html      Ultimatelly,I solved my problem.    My work is switch my application from mysql to sqlserver database .   At the very start,I forgot start sqlserver service,so the error "refused connect"  always appear,(so stupid error).Next,ther error  "Hibernate operation: could not execute query; uncategorized SQLException for SQL [select user0_.ID as ID, user0_.USERNAME as USERNAME0_, user0_.PASSWORD as PASSWORD0_ from user user0_]; SQL state [S1000]; error code [156]; 在關(guān)鍵字 'user' 附近有語法錯誤。; nested exception is java.sql.SQLException: 在關(guān)鍵字 'user' 附近有語法錯誤."   comes out ,  the problem scratchs my head over .this moring i got one friend's help and eventually found the "user" should not be used as a table name,because "user" is a key in sqlserver.  
      Below is work I have done : (Note: my env is eclipse+myeclipse)
      First:modify applicationContext.xml:
      
      From:
      1.<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
           <property name="driverClassName">
                 <value>com.mysql.jdbc.Driver</value>
           </property>
           <property name="url">
                <value>jdbc:mysql://localhost:3306/test</value>
           </property>
           <property name="username">
                <value>root</value>
           </property>
           <property name="password">
               <value>whl</value>
           </property>
        </bean>
     2. <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
     
     To:
        <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
              <property name="driverClassName">
                   <value>net.sourceforge.jtds.jdbc.Driver</value>
              </property>
              <property name="url">
                   <value>jdbc:jtds:sqlserver://localhost:1433/test</value>
               </property>
               <property name="username">
                    <value>sa</value>
               </property>
               <property name="password">
                    <value>mssqlsys</value>
              </property>
         </bean>

        <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
      Second: import the sqlserver driver:jtds-1.1.jar



freefly 2006-04-11 12:41 發(fā)表評論
]]>
solution for mess code in struts+spring+hibernate+mysql4.1 http://www.aygfsteel.com/freefly/archive/2006/03/23/37026.htmlfreeflyfreeflyThu, 23 Mar 2006 05:07:00 GMThttp://www.aygfsteel.com/freefly/archive/2006/03/23/37026.htmlhttp://www.aygfsteel.com/freefly/comments/37026.htmlhttp://www.aygfsteel.com/freefly/archive/2006/03/23/37026.html#Feedback0http://www.aygfsteel.com/freefly/comments/commentRss/37026.htmlhttp://www.aygfsteel.com/freefly/services/trackbacks/37026.html Here is my solution for  mess code on page,hope this can help you!
 The point is your database coding should be consistent with the coding of  character that you plan to insert into the database.
 Attention: Here,I take "UTF-8" as default character coding way .
 There are three steps:
 1. set page charset 
     e.g      <%@ page language="java" contentType="text/html; charset=UTF-8" %>
    
 2. create character filter:
     package com.victory.util;

     import javax.servlet.http.HttpServlet;
     import javax.servlet.Filter;
     import javax.servlet.FilterConfig;
     import javax.servlet.ServletException;
     import javax.servlet.ServletRequest;
     import javax.servlet.ServletResponse;
     import javax.servlet.FilterChain;
     import javax.servlet.http.*;
     import java.io.IOException;
     public class CharacterEncodingFilter
       extends HttpServlet
       implements Filter {

       private FilterConfig filterConfig;
       private String targetEncoding = "ASCII";

     /**
      * Called by the web container to indicate to a filter that it is being placed
      * into service.
      *
      * @param filterConfig FilterConfig
      * @throws ServletException
      * @todo Implement this javax.servlet.Filter method
     */
      public void init(FilterConfig filterConfig) throws ServletException {
      this.filterConfig = filterConfig;
      this.targetEncoding = filterConfig.getInitParameter("encoding");
     }

    /**
     * The <code>doFilter</code> method of the Filter is called by the container
     * each time a request/response pair is passed through the chain due to a
     * client request for a resource at the end of the chain.
     *
     * @param request ServletRequest
     * @param response ServletResponse
     * @param chain FilterChain
     * @throws IOException
     * @throws ServletException
     * @todo Implement this javax.servlet.Filter method
     */
     public void doFilter(ServletRequest srequest, ServletResponse sresponse,
                       FilterChain chain) throws IOException, ServletException {
      try {
        HttpServletRequest request = (HttpServletRequest) srequest;
        request.setCharacterEncoding(targetEncoding);
        chain.doFilter(srequest, sresponse);
          }
      catch (ServletException sx) {
         filterConfig.getServletContext().log(sx.getMessage());
          }
      catch (IOException iox) {
         filterConfig.getServletContext().log(iox.getMessage());
        }
      }

    /**
     * Called by the web container to indicate to a filter that it is being taken
     * out of service.
     *
     * @todo Implement this javax.servlet.Filter method
     */
     public void destroy() {
       filterConfig = null;
       targetEncoding = null;
     }
  }
  
  3.config web.xml
    attention: add these to your web.xml
     <filter>
     <filter-name>EncodingFilter</filter-name>
     <filter-class>com.victory.util.CharacterEncodingFilter</filter-class>
     <init-param>
       <param-name>encoding</param-name>
       <param-value>UTF-8</param-value>
     </init-param>
    </filter>
    <filter-mapping>
    <filter-name>EncodingFilter</filter-name>
     <url-pattern>/*</url-pattern>
    </filter-mapping> 
  4.set database configration
     modify the file:    my.ini
     [client]     default-character-set=utf8 
     [mysqld]  default-character-set=utf8
  5.restart Mysql server
  6.modified your table coding way to utf8

     or ceate your table like this :
     CREATE TABLE `user` (
    `ID` int(11) NOT NULL auto_increment,
    `USERNAME` varchar(50) NOT NULL default '',
    `PASSWORD` varchar(50) NOT NULL default '',
     PRIMARY KEY  (`ID`)
     ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 
  7.restrart your tomcat sever

   OK,it's all.

   Authrougn I have sovled   my problem, I think I  don't have enough understanding for it,  So hope    communicate with you! 

   Attention:mess code also exist in your database,through page hasn't mess code.
   
     


   
  
       
     



freefly 2006-03-23 13:07 發(fā)表評論
]]>
主站蜘蛛池模板: 天全县| 大悟县| 巩义市| 江口县| 延安市| 缙云县| 轮台县| 莆田市| 老河口市| 朝阳县| 南宁市| 泾川县| 应用必备| 汤原县| 漠河县| 四平市| 阜南县| 霍山县| 包头市| 城步| 美姑县| 思南县| 澄江县| 南丹县| 黑河市| 扎囊县| 丰城市| 乌鲁木齐市| 洮南市| 景洪市| 镇沅| 伊川县| 昆明市| 彭阳县| 宿松县| 茂名市| 萨嘎县| 马公市| 霸州市| 乌兰浩特市| 遵义县|