gpt4 book ai didi

java - 将记录插入数据库时​​出现 Java 堆空间错误?

转载 作者:行者123 更新时间:2023-11-30 09:23:28 25 4
gpt4 key购买 nike

我在尝试向数据库中插入记录时收到 Java 堆空间错误。我不确定 oracle 为什么能够消耗堆以及为什么消耗这么多。错误发生在这一行:

 Connection con       = null;
PreparedStatement ps = null;
ResultSet rs = null;
String sqlString = null;
DaoUtility dUtil = DaoUtility.getInstance();

try
{
con = dUtil.getConnection();
. . .
dUtil.executeUpdate(ps);

这是日志:

java.lang.OutOfMemoryError: Java heap space at java.lang.reflect.Array.newArray(Native Method) at java.lang.reflect.Array.newInstance(Array.java:52) at oracle.jdbc.driver.BufferCache.get(BufferCache.java:226) at oracle.jdbc.driver.PhysicalConnection.getCharBuffer(PhysicalConnection.java:7643) at oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers(OraclePreparedStatement.java:2949) at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:2355) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3571) at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3657) at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1350) at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:172)

最佳答案

Oracle JDBC 驱动程序因内存消耗而臭名昭著。请阅读 configuration parameters您可以使用它来控制其内存消耗。请特别注意您的情况的 oracle.jdbc.maxCachedBufferSize

关于java - 将记录插入数据库时​​出现 Java 堆空间错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16011897/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com