Sybase 16 的 HikariCP 可接受测试查询
HikariCP Acceptable Test Query for Sybase 16
下面的问题和答案非常适合回答除 Sybase ASE
(SAP ASE) 之外几乎所有数据库的这个问题:
Efficient SQL test query or validation query that will work across all (or most) databases
什么是适合 ASE 的设置?我将 ASE 16 与驱动程序一起使用:
spring.datasource.driver-class-name=com.sybase.jdbc4.jdbc.SybDriver
pom:
<dependency>
<groupId>com.sybase</groupId>
<artifactId>jconn4</artifactId>
<version>16</version>
</dependency>
从下面的错误来看,它似乎需要一个存储过程,但是当我尝试一个现有的存储过程时(与 "SELECT 1" 相对应)它也不起作用
HikariPool-1 - Failed to execute connection test query (Stored procedure '"SELECT 1"' not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).
应用属性:
spring.datasource.hikari.connection-test-query="SELECT 1"
In Sybase ASE select 可以没有 where 或 from 子句
A simple select statement contains only the select clause; the from clause is almost always included, but is necessary only in select statements that retrieve data from tables. All other clauses, including the where clause, are optional.
所以你可以只使用 Select 1
删除 双引号 example
connection-test-query: SELECT 1
下面的问题和答案非常适合回答除 Sybase ASE
(SAP ASE) 之外几乎所有数据库的这个问题:
Efficient SQL test query or validation query that will work across all (or most) databases
什么是适合 ASE 的设置?我将 ASE 16 与驱动程序一起使用:
spring.datasource.driver-class-name=com.sybase.jdbc4.jdbc.SybDriver
pom:
<dependency>
<groupId>com.sybase</groupId>
<artifactId>jconn4</artifactId>
<version>16</version>
</dependency>
从下面的错误来看,它似乎需要一个存储过程,但是当我尝试一个现有的存储过程时(与 "SELECT 1" 相对应)它也不起作用
HikariPool-1 - Failed to execute connection test query (Stored procedure '"SELECT 1"' not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).
应用属性:
spring.datasource.hikari.connection-test-query="SELECT 1"
In Sybase ASE select 可以没有 where 或 from 子句
A simple select statement contains only the select clause; the from clause is almost always included, but is necessary only in select statements that retrieve data from tables. All other clauses, including the where clause, are optional.
所以你可以只使用 Select 1
删除 双引号 example
connection-test-query: SELECT 1