3

We have an event generation mechanism that generates & save the events in a flatfile (or say DB file to make it easy).

To view this event in DB we complete the run for generating the events & then we use "SQuirreL SQL Client 3.5.0".

When the size of this db file is small SQuirreL Client works fine. But when the size grows near to 20MB, it refuses to open the database & throws below exception -

Unexpected Error occurred attempting to open an SQL connection.

Below is the StackTrace for your reference:

java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.sql.SQLException: Out of Memory
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:202)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.awaitConnection(OpenConnectionCommand.java:132)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access$100(OpenConnectionCommand.java:45)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand$2.run(OpenConnectionCommand.java:115)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.RuntimeException: java.sql.SQLException: Out of Memory
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.executeConnect(OpenConnectionCommand.java:171)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access$000(OpenConnectionCommand.java:45)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand$1.run(OpenConnectionCommand.java:104)
    ... 5 more
Caused by: java.sql.SQLException: Out of Memory
    at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
    at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
    at org.hsqldb.jdbc.JDBCConnection.<init>(Unknown Source)
    at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
    at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source)
    at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:133)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.executeConnect(OpenConnectionCommand.java:167)
    ... 7 more
Caused by: org.hsqldb.HsqlException: Out of Memory
    at org.hsqldb.error.Error.error(Unknown Source)
    at org.hsqldb.error.Error.error(Unknown Source)
    at org.hsqldb.persist.ScriptRunner.runScript(Unknown Source)
    at org.hsqldb.persist.ScriptRunner.runScript(Unknown Source)
    at org.hsqldb.persist.Log.processLog(Unknown Source)
    at org.hsqldb.persist.Log.open(Unknown Source)
    at org.hsqldb.persist.Logger.openPersistence(Unknown Source)
    at org.hsqldb.Database.reopen(Unknown Source)
    at org.hsqldb.Database.open(Unknown Source)
    at org.hsqldb.DatabaseManager.getDatabase(Unknown Source)
    at org.hsqldb.DatabaseManager.newSession(Unknown Source)
    ... 12 more
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Xat
  • 127
  • 1
  • 3
  • 10

1 Answers1

1

Try increasing the memory allocated to SQuirreL. Open the script or batch file in a text editor and change the amount of memory allocated. Look for -Xmx256m and replace the 256 with a larger number.

On Windows the file is squirrel-sql.bat, on Linux it is squirrel-sql.sh

Colin Bell
  • 361
  • 2
  • 4
  • Thanks Colin. It is working perfectly as expected. I have provided 2048 instead of 256. So does that mean I can provide any thing here like 4096 to 16384 and so on ? Also can you please explain the technical reason for this issue. Thanks in advance. – Xat Dec 20 '14 at 18:52
  • -Xmx is a java argument that specifies the maximum size of memory that can be allocated by the running program. – Colin Bell Dec 21 '14 at 21:21
  • Hi Colin. My system has 8GB RAM. When the data is around 100,000 Squirrel works fine but when it is more like a million or more it throws back the same exception. What should I suppose to do in such cases !! – Xat Dec 22 '14 at 13:37
  • Without knowing what you are trying to do it is difficult to give any advice but I would try to split the flat file up into several files and process them separately. – Colin Bell Dec 22 '14 at 22:35
  • You got it right Colin. There is only one flat file which we do not split. And when we test event generation, we generate events in bulk like anything between 5 Million - 10 Million events. These events gets stored in this flat file. Now when we try to view this kind of record using Squirrel client, it fails to connect DB & throws this exception. Hope I have explained it better this time. – Xat Dec 24 '14 at 08:14
  • Is there an any other SQL client that we can use instead of Squirrel SQL client. – Xat Dec 24 '14 at 11:57
  • Hi, I have got another lead, which is useful to some extent. Though I cannot not see all the events generated but I can find the total event count at-least using this. 1. Go to location where "hsqldb-2.2.8.jar" is present. 2. Open CMD prompt. 3. Run below command. > java -jar hsqldb-2.2.8.jar 4. It will open HSQL Database Manager UI. 5. Open Connect window & provide the URL to connect to database. 6. This will load the schema & the you can use the select query to fetch the required details. Note - For a bigger DB size say 428 MB, it may take some time but it will load eventually. – Xat Jan 05 '15 at 11:41