pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jim Davis <j.a.davis@larc.nasa.gov>
To: pgsql-jdbc@postgresql.org
Subject: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Date: Thu, 24 Aug 2006 13:08:51 -0400
Message-ID: <44EDDD23.2040605@larcb.ecs.nasa.gov> (raw)

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.



view thread (9+ messages)  latest in thread

Message-ID: <44EDDD23.2040605@larcb.ecs.nasa.gov>
Permalink:  ../44EDDD23.2040605@larcb.ecs.nasa.gov/
Also on:    postgresql.org/message-id/44EDDD23.2040605@larcb.ecs.nasa.gov

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: j.a.davis@larc.nasa.gov
  Subject: Re: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
  In-Reply-To: <44EDDD23.2040605@larcb.ecs.nasa.gov>
  References: <44EDDD23.2040605@larcb.ecs.nasa.gov>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox