Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

From: Jim Davis <j(dot)a(dot)davis(at)larc(dot)nasa(dot)gov>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Date: 2006-08-24 17:08:51
Message-ID: 44EDDD23.2040605@larcb.ecs.nasa.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I am not a java programmer, so it is possible I am doing something wrong:

I saw this problem initially on my test system using sequoia jdbc driver
with my postgresql 8.1.4 database servers trying
to create an index on a 27 million row table. After many suggestions
and tests, It was suggested I try using the postgresql
jdbc driver to perform the create index to try and isolate where the out
of memory condition is occurring. So I edited a
java application I was testing with and pointed it to the postgresql
jdbc driver. I used version postgresql-.2dev-503.jdbc3.jar
the first time and postgresql-9.2dev-503.jdbc3.jar the second time with
the same results: Exception in thread "main" java.lang.OutOfMemoryError:
Java heap space

Below is the java code I am using to try to do this:

**
*
*/
import java.sql.*;
/**
* @author jdavis
*
*/
public class jdbcpostgrestestcreateindex {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

String url = "jdbc:postgresql://10.10.101.14:3153/ange";
Connection con;

try {
Class.forName("org.postgresql.Driver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}

try {
con = DriverManager.getConnection(url,"user","XXXXXXX");
con.setAutoCommit(false);
Statement s = con.createStatement();
s.setCursorName("cursor name");
s.setFetchSize(100);
String createTableIndexString = "create index
file_name_idx on catalog using btree {file_name}";
s.executeUpdate(createTableIndexString);
con.commit();
s.close();
con.close();
} catch (SQLException ex) {
System.err.print("SQLException: ");
System.err.println(ex.getMessage());
}
}

}

If this is not a bug, any hints or examples of the correct way to do
this would be appreciated.
I am unsure how to grab a stack trace, if one is needed please send me
an example and I will
be glad to add the code and re-run the test to provide that information.

Thanks,

Jim D.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2006-08-24 17:28:14 Re: Small problem with special characters
Previous Message Thomas Kellerer 2006-08-24 16:48:12 Re: Small problem with special characters