首先对不起我的英语它是我的第二语言。
我正在尝试从 websphere 服务器迁移到 tomcat 8 服务器。除了与数据库的连接外,一切都运行良好。
据我了解,我在不同的地方查看我必须修改 context.xml 但我不断收到此日志表单 tomcat:
第一部分翻译为“声明池时出现问题”
[BDD 错误] Probl?me lors de la d?claration du pool:无法创建资源实例
这是 context.xml 和我用来连接数据库的类。
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/CGR_Server" reloadable="true">
<Resource auth="Container"
name="java:comp/env/jdbc/OLA"
type="javax.sql.DataSource"
driverClassName="com.ibm.as400.access.AS400JDBCConnectionPoolDataSource"
url="jdbc:as400://OLA;naming=system;errors=full;"
username="XXXX"
password="XXXX"
maxIdle="10"
maxActive="200"
maxWait="5"
removeAbandoned="true"
removeAbandonedTimeout="1200"
/>
</Context>
连接as400的方法
public boolean open(){
DataSource source=null;
try {
source= (DataSource) new InitialContext().lookup(pools[as400]);
connection = source.getConnection();
if (connection == null){
return false;
}else{
connection.setAutoCommit(autoCommit);
if(scroll){
stmt=connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
}else{
stmt=connection.createStatement();
}
}
} catch (NamingException e) {
traitementErreur(e);
return false;
} catch (SQLException e) {
traitementErreur(e);
return false;
} catch (Exception e) {
traitementErreur(e);
return false;
}
return true;
}