我通过以下方式配置了连接池:
import mmap
import socket
import ctypes
# get hostname
machine_name=(socket.gethostname())
f = open('c:\\path\to\myfile'+machine_name+'.log')
s = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
if s.find('ERROR') != -1:
ctypes.windll.user32.MessageBoxW(0, "ERROR Has Been Found", "Error", 1)
但是验证查询似乎没有效果。
因此,如果我在Karaf控制台中发出命令“ service:list DataSourceFactory”,则会看到以下数据源:
osgi.jdbc.driver.name = wrap_mvn_com.oracle_ojdbc6_12.1.0.2-pool
url = jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = myhost.it)(PORT = 1521))(LOAD_BALANCE = yes)(failover=on)(enable=broken)(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = myservice.it)(failover_mode =(type = select)(method = basic)(retries = 180)(delay = 5))))
databaseName = xxx
user = xxx
password = xxx
dataSourceName = xyz
pool = dbcp2
xa = true
jdbc.pool.maxIdle = 1
jdbc.pool.maxTotal = 1
jdbc.pool.minIdle = 5
jdbc.pool.maxWaitMillis = 10000
jdbc.pool.jmxEnabled = true
jdbc.factory.validationQuery = select 1 from dual
jdbc.factory.fastFailValidation = true
但是如果我这样启用
[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
osgi.jdbc.driver.class = oracle.jdbc.OracleDriver-pool-xa
osgi.jdbc.driver.name = wrap_mvn_com.oracle_ojdbc6_12.1.0.2-pool-xa
osgi.jdbc.driver.version = 0.0.0
pooled = true
service.bundleid = 167
service.id = 202
service.scope = singleton
xa = true
Provided by :
OPS4J Pax JDBC Pooling Support using Commons-DBCP2 (167)
Used by:
OPS4J Pax JDBC Config (165)
我收到以下错误:
osgi.jdbc.driver.name = wrap_mvn_com.oracle_ojdbc6_12.1.0.2-pool-xa
我要提交的错误是什么?如果验证查询给出错误的结果,我应该期待什么?
我的应用程序的persistence.xml中是否需要某些特定属性?