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 閱讀(360) 評論(0)  編輯  收藏 所屬分類: Hibernate

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


          網站導航:
           
          主站蜘蛛池模板: 吉安县| 遂昌县| 石河子市| 东方市| 施甸县| 洛扎县| 海丰县| 葫芦岛市| 高平市| 嘉善县| 松溪县| 阿城市| 宿州市| 彭州市| 青龙| 阿鲁科尔沁旗| 佛冈县| 嘉黎县| 邮箱| 江油市| 益阳市| 赤壁市| 泉州市| 金塔县| 麻江县| 遂昌县| 房山区| 凯里市| 仙游县| 乌鲁木齐县| 青海省| 南康市| 姚安县| 四川省| 特克斯县| 佛冈县| 裕民县| 镇赉县| 崇义县| 定陶县| 治县。|