gpt4 book ai didi

java - com.zaxxer.hikari.pool.HikariPool$PoolInitializationException : Failed to initialize pool: ORA-00923: FROM keyword not found where expected

转载 作者:行者123 更新时间:2023-11-29 04:22:20 24 4
gpt4 key购买 nike

我开始了解 HikariCP,所以尝试了一下,但在运行时遇到了这个异常。找不到根本原因是什么。任何人都知道如何解决它?

我只是简单地使用 jdbcteplate batchupdate 将 id、name 插入到 person 表中。

<bean id="hikariConfig" class="com.zaxxer.hikari.HikariConfig">
<property name="poolName" value="springHikariCP" />
<property name="connectionTestQuery" value="SELECT 1" />
<property name="dataSourceClassName" value="oracle.jdbc.pool.OracleDataSource" />
<property name="maximumPoolSize" value="30" />
<property name="idleTimeout" value="30000" />

<property name="dataSourceProperties">
<props>
<prop key="url">jdbc:oracle:thin:@localhost:1521:orcl</prop>
<prop key="user">TEST</prop>
<prop key="password">TEST</prop>
</props>
</property>
</bean>
<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource">
<constructor-arg ref="hikariConfig" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource"></property>
</bean>

<bean id="HikariCpSample" class="com.ignite.sample.clustering.HikariCpSample">
<property name="jdbcTemplate" ref="jdbcTemplate"></property>
</bean>​

线程“主”中的异常 org.springframework.beans.factory.BeanCreationException:创建类路径资源 [spring.xml] 中定义的名为“dataSource”的 bean 时出错: 通过构造函数的 Bean 实例化失败;嵌套的异常是 org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Constructor throw exception;嵌套异常是 com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: 初始化池失败: ORA-00923: FROM keyword not found where expected

最佳答案

您的 connectionTestQuery 属性值应该是有效的 SQL,对于 Oracle,请使用 SELECT 1 from dual。将其更改为:

   <property name="connectionTestQuery" value="SELECT 1 from dual" />

关于java - com.zaxxer.hikari.pool.HikariPool$PoolInitializationException : Failed to initialize pool: ORA-00923: FROM keyword not found where expected,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48324545/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com