码头和Oracle连接池 [英] jetty and Oracle Connection Pooling

查看:112
本文介绍了码头和Oracle连接池的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在将我的Oracle数据源池创建从我的Spring配置转移到码头配置,但是我在下面收到错误消息

I am currently moving my Oracle Datasource pool creation from my Spring config to a jetty config, but I am getting the error below

[警告]出现配置错误

[WARNING] Config error at

我在Spring中的数据源配置看起来像

My Datasource config in Spring looks like

@Bean
public DataSource dataSource() throws IllegalStateException, SQLException {
    PoolDataSource dataSource = PoolDataSourceFactory.getPoolDataSource();

    dataSource.setConnectionFactoryClassName(env.getRequiredProperty(DB_CONNECTION_FACTORY_CLASS_NAME));
    dataSource.setURL(env.getRequiredProperty(DATABASE_URL));
    dataSource.setUser(env.getRequiredProperty(DATABASE_USERNAME));
    dataSource.setPassword(env.getRequiredProperty(DATABASE_PASSWORD));
    dataSource.setMinPoolSize(Integer.parseInt(env.getRequiredProperty(DATABASE_CONNECTION_MIN_POOL_SIZE)));
    dataSource.setMaxPoolSize(Integer.parseInt(env.getRequiredProperty(DATABASE_CONNECTION_MAX_POOL_SIZE)));
    dataSource.setInitialPoolSize(Integer.parseInt(env.getRequiredProperty(DATABASE_CONNECTION_INITIAL_POOL_SIZE)));

    return dataSource;
} 

在码头配置中,它看起来像

In the jetty config, it looks like

   <New id="pds_datasource_pool" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg><Ref refid="wac"/></Arg>
<Arg>jdbc/pdsds</Arg>
<Arg>
  <New class="oracle.ucp.jdbc.PoolDataSource">
    <Set name="uRL">jdbc:oracle:thin:xxx</Set>
    <Set name="user">user</Set>
    <Set name="password">user_dev_01</Set>
    <Set name="minPoolSize">2</Set>
    <Set name="maxPoolSize">10</Set>
    <Set name="initialPoolSize">2</Set>
    <Set name="connectionFactoryClassName">oracle.jdbc.replay.OracleDataSourceImpl</Set>
  </New>
</Arg>

日志仅显示上述错误,我不太清楚问题出在哪里.我还把2个Oracle jar作为依赖项包括在内,但似乎不起作用.

The logs only show the error mentioned above and I am not too sure what the problem is. I also included the 2 Oracle jars as dependencies but does not seem to work.

非常感谢您的帮助.

欢呼

克里斯

推荐答案

在此处回答自己的帖子.这是在Jetty中配置池的设置

Answering my own post here. Here are the settings to configure pooling in Jetty

   <New id="pDatasourcePool" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg><Ref refid="wac"/></Arg>
<Arg>jdbc/projectds</Arg>
<Arg>
  <Call class="oracle.ucp.jdbc.PoolDataSourceFactory" name="getPoolDataSource" >
    <Set name="URL">jdbc:oracle:thin:xxx</Set>
    <Set name="user">user</Set>
    <Set name="password">ser_dev1</Set>
    <Set name="minPoolSize">2</Set>
    <Set name="maxPoolSize">10</Set>
    <Set name="initialPoolSize">2</Set>
    <Set name="connectionFactoryClassName">oracle.jdbc.replay.OracleDataSourceImpl</Set>
  </Call>
</Arg>

这篇关于码头和Oracle连接池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆