如何验证我的代码与Oracle DB的连接是否建立?
下面是我的spring boot属性文件中的配置参数:
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql = true
spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect
oracle.username=username
oracle.password=password
oracle.url=jdbc:oracle:thin:username/password@//ipaddress:1521/dbname
当我尝试从数据库中获取数据时,它显示此错误:
org.hibernate.exception.SQLGrammarException:
无法准备语句
下面是示例代码:
@Repository
public interface AmountRepository extends JpaRepository<POJO, Integer> {
@Query(
value = "select t.mov_flg,t.net_val,t.loc_cd,t.trn_type,t.trn_no,\r\n" +
" t.trn_dt,t.created_dt,tr.term_amt,t.gross_val\r\n"
+ " from inv_thdr,\r\n" +
" tr where t.trn_no=term_trn.term_no and t.trn_type='EBO'
and t.loc_cd=3 and t.trn_no>3",
nativeQuery = true
)
public List<POJO> getLastHoursData(@Param("transactionNo") Integer transactionNo);
}