VAJAVA + Lotus Domino JDBC -> VM Memory Problems
Date: Thu, 23 Dec 1999 16:53:56 +0100
Message-ID: <38624594.B3C73913_at_sercon.de>
When using IBM Visual for Java and the Lotus Domino JDBC Driver i get a java.lang.OutOfMemoryError if the result of my SQL statement is to big.
I tried VA Java Enterprise 2.0 with Rollup2 and VA Java Enterprise 3.0
Java2
on Windows NT 4.0 with SP5
When i run the java programm on the SUN JDK 1.2.2 VM i have no problems.
How can i increase the VM Memory for VAJAVA or is something wrong with my java code ?
What is the limit for SQL statements with the Lotus Domino JDBC Driver or in general with JDBC Drivers ?
I saw several of this OutOfMemoryError errors with other JDBC Drivers in the newsgroups.
Thanks
Frank Schofer
frank.schofer_at_sercon.de
console output + error message:
- i changed the db name and server name Connecting to URL jdbc:domino:/notesdbname.nsf/servername
Executing... SELECT Categories, ExpireDate FROM Hauptthema WHERE Categories = 'Jokes'
Colums: 2
total memory: 32362388
free memory: 1963188
message:null
stacktrace:
java.lang.OutOfMemoryError
java.lang.Throwable() java.lang.Error() java.lang.VirtualMachineError() java.lang.OutOfMemoryError() int lotus.jdbc.domino.DominoStmtCLI.sqlColAttributes(int, int, int) java.lang.String lotus.jdbc.domino.DominoStmtCLI.getColumnLabel(int)java.lang.String
lotus.jdbc.domino.DominoResultSetMetaData.getColumnLabel(int) void Test2.printResults(java.sql.ResultSet) void Test2.main(java.lang.String [])
source code:
import java.util.*; import java.sql.*; import java.sql.Date;
import lotus.jdbc.domino.*;
public class Test2
{
public Test2() {
super();
initialize();
}
/** * Called whenever the part throws an exception. * _at_param exception java.lang.Throwable */
private void handleException(java.lang.Throwable exception) {
/* Uncomment the following lines to print uncaught exceptions to stdout */ // System.out.println("--------- UNCAUGHT EXCEPTION ---------"); // exception.printStackTrace(System.out);
}
/** * Initialize the class. */ /* WARNING: THIS METHOD WILL BE REGENERATED. */private void initialize() {
try {
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
// user code begin {2}
// user code end
}
public static void main( String[] args)
{
Connection con; Statement stmt; ResultSet rs;
ResultSetMetaData rsmd = null;
String name;
String sql = "SELECT Categories, ExpireDate FROM Hauptthema WHERE Categories = 'Jokes'";
- i changed the db name and server name String connStr = "jdbc:domino:/notesdbname.nsf/servername"; try {
try {
Class.forName("lotus.jdbc.domino.DominoDriver"); }
catch (ClassNotFoundException e) {
System.out.println("ClassNotFoundExecption: " + e.getMessage());
}
// GET CONNECTION
System.out.println();
System.out.println("Connecting to URL " + connStr);
con = DriverManager.getConnection(connStr,"","");
System.out.println();
// Create Statement
stmt = con.createStatement();
// Execute statement
rs = stmt.executeQuery(sql);
System.out.println("Executing... " + sql);
if (rs != null) {
System.out.println("test");
printResults(rs);
}
// Close the results
rs.close();
// Close the statement
stmt.close();
// Close the connection
con.close();
}
catch (OutOfMemoryError oome) {
System.out.println("message:" + oome.getMessage()); System.out.println(); System.out.println("stacktrace:"); oome.printStackTrace();
}
catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
} // end of main
// print the results
public static void printResults(ResultSet results)
{
try {
// GET ALL RESULTS
StringBuffer buf = new StringBuffer();
ResultSetMetaData rsmd = results.getMetaData();
// results.
int numCols = rsmd.getColumnCount();
System.out.println("Colums: " + numCols);
int i, rowcount = 0;
// print memory usage of the runtime environment
Runtime rt = null;
rt = Runtime.getRuntime();
System.out.println("total memory: " + rt.totalMemory() ); System.out.println("free memory: " + rt.freeMemory() );
// get column header info
for (i=1; i <= numCols; i++){
if (i > 1) buf.append(", ");
buf.append(rsmd.getColumnLabel(i));
}
buf.append("\n");
System.out.println("Free Memory: " + rt.freeMemory() );
// break it off at 100 rows max
while (results.next() && rowcount < 100){
System.out.println("Free Memory: " + rt.freeMemory() );
// Loop through each column, getting the column
// data and displaying
for (i=1; i <= numCols; i++) {
if (i > 1) buf.append(",");
buf.append(results.getString(i));
// System.out.print(results.getString(i));
}
buf.append("\n");
rowcount++;
}
// Output
System.out.println(buf);
} catch (Exception e) {
e.printStackTrace();
return;
}
} // end printResults
}
Received on Thu Dec 23 1999 - 16:53:56 CET