我们正在从WAS8迁移到Tomcat8。在Tomcat中,我们需要使用Java的JNDI for IMS建立连接。

我面临为IBM IMS的JNDI连接创建“ URL”的问题,下面是IBM IMS JDBC jar给定的URL结构

对于driverType 4“ jdbc:ims:// datastoreServer [:port] / databaseName [:property = value;]”;

对于driverType 2“ jdbc:ims:databaseName [:property = value;]”;

这就是我创造的

jdbc:ims://xx.xx.xxx.com:4034;datastoreName=XXX34;dpsbOnCommit=true;


但是在连接期间给我错误

Dec 07, 2017 12:55:30 PM org.apache.naming.NamingContext lookup
WARNING: Unexpected exception resolving reference
java.sql.SQLException: Invalid URL syntax: databaseName not specified properly. Correct syntax: jdbc:ims://datastoreServer[:port]/databaseName[:property=value;]
    at com.ibm.ims.jdbc.IMSDriver.parseOptionalPortNumber(IMSDriver.java:1031)
    at com.ibm.ims.jdbc.IMSDriver.connect(IMSDriver.java:211)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:307)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:200)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:708)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:642)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:464)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:141)
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:115)
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:102)
    at org.apache.tomcat.jdbc.pool.DataSourceFactory.createDataSource(DataSourceFactory.java:553)
    at org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance(DataSourceFactory.java:241)
    at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:94)
    at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:841)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:829)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:829)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:152)


上面的问题看起来通过正确的URL参数解决了,但是现在我遇到了错误

java.sql.SQLException: An error occurred reading from the socket input stream: java.net.SocketException: Software caused connection abort: recv failed.
    at com.ibm.ims.jdbc.ConnectionImpl.init(ConnectionImpl.java:309)
    at com.ibm.ims.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:95)
    at com.ibm.ims.jdbc.IMSDriver.connect(IMSDriver.java:450)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:307)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:200)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:708)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:642)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:464)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:141)
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:115)
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:102)
    at org.apache.tomcat.jdbc.pool.DataSourceFactory.createDataSource(DataSourceFactory.java:553)
    at org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance(DataSourceFactory.java:241)
    at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:94)
    at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:841)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:829)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:166)
    at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1084)
    at org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:663)
    at org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:256)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: com.ibm.ims.drda.base.DisconnectException: An error occurred reading from the socket input stream: java.net.SocketException: Software caused connection abort: recv failed.
    at com.ibm.ims.drda.t4.Reply.fill(Reply.java:801)
    at com.ibm.ims.drda.t4.Reply.ensureALayerDataInBuffer(Reply.java:752)
    at com.ibm.ims.drda.t4.Reply.readDssHeader(Reply.java:937)
    at com.ibm.ims.drda.t4.Reply.startSameIdChainParse(Reply.java:132)
    at com.ibm.ims.drda.t4.T4ConnectionReply.readExchangeServerAttributes(T4ConnectionReply.java:710)
    at com.ibm.ims.drda.t4.T4Connection.readServerAttributesAndKeyExchange(T4Connection.java:283)
    at com.ibm.ims.drda.t4.T4Connection.flowServerAttributesAndKeyExchange(T4Connection.java:263)
    at com.ibm.ims.drda.t4.T4Connection.flowDRDAConnect(T4Connection.java:248)
    at com.ibm.ims.drda.t4.T4Connection.flowConnect(T4Connection.java:231)
    at com.ibm.ims.drda.t4.T4Connection.initialize(T4Connection.java:218)
    at com.ibm.ims.drda.t4.T4Connection.<init>(T4Connection.java:84)
    at com.ibm.ims.drda.db.DRDAEngine.establishAuthenticatedSocketConnection(DRDAEngine.java:205)
    at com.ibm.ims.jdbc.ConnectionImpl.init(ConnectionImpl.java:258)
    ... 31 more
Caused by: java.net.SocketException: Software caused connection abort: recv failed
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at com.ibm.ims.drda.t4.Reply.fill(Reply.java:796)
    ... 43 more

最佳答案

对于Type-4连接网址:

jdbc:ims://datastoreServer[:port]/databaseName[:property=value;]


如果使用的是IMS目录,则应使用您的PSB名称替换databaseName占位符

或搭配

class://your.fully.qualified.PSBNameDatabaseView


如果您使用的是本地元数据文件

07-27 18:13