spring+hibernate相关异常

org.springframework.jdbc.UncategorizedSQLException:

1.常见引起原因是配置:数据库oracel

<property name="url">
   <value>jdbc:oracle:thin:@127.0.0.1:1521:cipdata;SelectMethod=Cursor</value>
  </property> 

将红色部分去掉

SQLSERVER:< <value>   jdbc:oracle:thin:@127.0.0.1:1521:cipdata;SelectMethod=Cursor

</value>

去掉空格和回车: <value>jdbc:oracle:thin:@localhost:1521:cipdata;SelectMethod=Cursor</value>

 

2.参数注入

类型不配,数量不配.

where 后有时间时,应将时间条件在最后比如:

 from ast_waa_sa aws where aws.flight_Date<=TO_DATE('2009-01-29 23:59:59','YYYY-MM-DD HH24:MI:SS') and aws.end_port_name=:end_port_name

这样有时就会出UncategorizedSQLException错.改成

from ast_waa_sa aws where aws.end_port_name=:end_port_name and  aws.flight_Date<=TO_DATE('2009-01-29 23:59:59','YYYY-MM-DD HH24:MI:SS') 就行了.

你可能感兴趣的:(spring,oracle,Hibernate,Date,jdbc,sqlserver)