1

为什么这段代码会使 JVM 崩溃?

public Connection createConnectionFromDS() throws Exception {
    try {
        Connection con = null;
        Properties props = new Properties();
        props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
        props.put(Context.PROVIDER_URL, "my_ip");
        Context ctx = new InitialContext(props);
        log.debug("Looking up datasource " + dataSourceName);
        DataSource dataSource = (javax.sql.DataSource) ctx.lookup(dataSourceName);
        con = dataSource.getConnection();
        return con;
    } catch (NameNotFoundException e) {
        throw new Exception("Datasource [" + dataSourceName + "] not bound!");
    }
}

日志如下:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000001800060ba, pid=3816, tid=3076
#
# JRE version: 6.0_39-b04
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.14-b01 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [db2jcct2.dll+0x60ba]

我已经从 6.0_29 升级到了 6.0_39,但是并没有解决问题。

4

1 回答 1

4

简而言之,它不应该。这看起来像是db2jcct2.dll(您的 DB2 驱动程序)中的一个错误。

# Problematic frame:
# C  [db2jcct2.dll+0x60ba]

您可以尝试其他版本的 JDBC 驱动程序吗?和/或将此报告给 IBM ?

于 2013-02-11T15:07:15.563 回答