"Unexpected Error occurred attempting to open an SQL connection." when opening InMemory DB using SQuirreL SQL Client 3.5.0

Xat picture Xat · Dec 19, 2014 · Viewed 17.8k times · Source

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

Answer

Colin Bell picture Colin Bell · Dec 20, 2014

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