freefly
          一門技術,如果不能講出來,那么就是沒有理解,如果不能很好的講出來,那么就是理解不夠透徹!
          posts - 9,comments - 3,trackbacks - 0

                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]; 在關鍵字 'user' 附近有語法錯誤。; nested exception is java.sql.SQLException: 在關鍵字 '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

          posted on 2006-04-11 12:41 freefly 閱讀(367) 評論(0)  編輯  收藏 所屬分類: Hibernate

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 鄂温| 黄龙县| 南木林县| 定远县| 金塔县| 庆云县| 微博| 休宁县| 荔波县| 巴马| 报价| 昌平区| 西藏| 新竹市| 玛沁县| 宁强县| 南华县| 海南省| 华容县| 沁阳市| 卢龙县| 敦化市| 海伦市| 游戏| 南宁市| 鸡东县| 永清县| 凭祥市| 宁海县| 兴和县| 军事| 武宁县| 阳曲县| 南通市| 和平县| 高台县| 屏东县| 西藏| 镶黄旗| 曲阳县| 德惠市|