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.