我正在尝试在net beans数据库中加载100,000条记录并最终收到此错误:
java.sql.SQLException: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ001, SQLERRMC: java.lang.OutOfMemoryErrorPermGen spaceXJ001.U
at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.Connection.prepareStatement(Unknown Source)
at etl1.DBhandler.insertShuj1(DBhandler.java:150)
at etl1.ETL1.shuja(ETL1.java:70)
at etl1.ETL1.main(ETL1.java:32)
Caused by: org.apache.derby.client.am.SqlException: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ001, SQLERRMC: java.lang.OutOfMemoryErrorPermGen spaceXJ001.U
at org.apache.derby.client.am.Statement.completeSqlca(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parsePrepareError(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown Source)
at org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.readPrepareDescribeInputOutput(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.flowPrepareDescribeInputOutput(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.prepare(Unknown Source)
at org.apache.derby.client.am.Connection.prepareStatementX(Unknown Source)
... 4 more
java.sql.SQLNonTransientConnectionException: A network protocol error was encountered and the connection has been terminated: the requested command encountered an unarchitected and implementation-specific condition for which there was no architected message (additional information may be available in the derby.log file on the server)
at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.Connection.prepareStatement(Unknown Source)
at etl1.DBhandler.insertShuj1(DBhandler.java:150)
at etl1.ETL1.shuja(ETL1.java:70)
at etl1.ETL1.main(ETL1.java:32)
Caused by: org.apache.derby.client.am.SqlException: A network protocol error was encountered and the connection has been terminated: the requested command encountered an unarchitected and implementation-specific condition for which there was no architected message (additional information may be available in the derby.log file on the server)
at org.apache.derby.client.am.SqlException.copyAsUnchainedSQLException(Unknown Source)
at org.apache.derby.client.am.Sqlca.chainDeferredExceptionsToAgentOrAsConnectionWarnings(Unknown Source)
at org.apache.derby.client.am.Sqlca.getJDBCMessage(Unknown Source)
at org.apache.derby.client.am.SqlException.getMessage(Unknown Source)
... 5 more
java.sql.SQLNonTransientConnectionException: No current connection.
at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.Connection.prepareStatement(Unknown Source)
at etl1.DBhandler.insertShuj1(DBhandler.java:150)
at etl1.ETL1.shuja(ETL1.java:70)
at etl1.ETL1.main(ETL1.java:32)
我确实知道内存不够,但应该如何增加呢?真的需要帮助
答案 0 :(得分:0)
在所谓的“永久”堆中,您的空间不足。试试-XX:MaxPermSize=128m
或-XX:MaxPermSize=256m
。您可能还需要增加常规堆,例如-Xmx1024m
。