[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
OutOfMemoryError  XML
Forum Index » Jisql
Author Message
gnaryak

Newbie

Joined: 09/20/2006 05:42:47
Messages: 3
Offline

I am running jisql on Linux and connecting to MS SQL Server. I run it with the following command:
$JAVA_HOME/bin/java -classpath ../javalib/database/jisql.jar:../javalib/database/jtds-1.2.jar com.xigole.util.sql.Jisql -driver net.sourceforge.jtds.jdbc.Driver

For the most part, jisql is working great. (Thanks!) I have encountered a problem, however. I wrote a function that separately queries several database tables, then aggregates the results and returns them. I can invoke the function without any problems from SQL Explorer running in Eclipse. I run it as:
select * from healthCheck()

When I run the same function from jisql, I get the following error:
Exception in thread "main" java.lang.OutOfMemoryError: Requested array size exceeds VM limit

I tried adding -Xms64M -Xmx512M parameters to the command that opens jisql but that didn't change anything. When I was trying to run this, there were 0 rows returned by healthCheck() so it does not seem to be caused by the size of the result set.

Thanks in advance for any help you may be able to provide!
-Andrew Guldman
stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 703
Location: Superior, CO, USA
Offline

I'll have to experiment a bit with this. I haven't personally used methods in MS/SQL so it may be that I'm doing something not too bright with them. How many rows are returned for your query?

In looking at the code I just walk through the ResultSet so I'm not sure where there is an array getting allocated. I know that with an OutOfMemoryException there sometimes isn't a stack trace. Does there happen to be one from your error?

Either way, let me take a look and see if I can figure out what is going on.

Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
gnaryak

Newbie

Joined: 09/20/2006 05:42:47
Messages: 3
Offline

Thanks for your quick reply. I appreciate your help. I did not get a stack trace from the error. There are 0 rows in the result set.

Thanks,
Andrew
Cédric

Newbie

Joined: 09/22/2006 08:38:53
Messages: 1
Location: Nantes, FRANCE
Offline

Same here.
The stringbuffer you use to build the rows representation before printing them can't handle too large rows. It oups on blobs here.
So I change the code for my personnal need to be :
and remove all the debug/headers/.. stuff around line 300->370

Thanks anyway for this usefull peace of code. Kiss

stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 703
Location: Superior, CO, USA
Offline

Thanks for the info! I guess I should check the data type being returned and do something different if it is a blob or clob. I'll see if I can get a new version out in a day or two. I appreciate the help figuring out the problem.

This message was edited 1 time. Last update was at 09/22/2006 09:09:31


Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
mrider

Newbie

Joined: 10/25/2005 11:50:02
Messages: 23
Offline

Well, I don't know if you want to incorporate this into your tree or not stdunbar. You are more than welcome to this if you want it. I promised I'd post this in my previous JISQL post, and then got busy and forgot.

If this helps great. If not I won't be offended

[EDIT]
Sheesh, forgot to mention this... I added the ability to specify an output formatter. To use the formatter, one needs to edit the template properties file and put the fully qualified path to an object that implements the OutputFormatter interface. When starting the program one needs to supply the full path to the properties file that contains the mapping of SQL type to formatter.

Armed with this you could easily specify a formatter for blob types, and then tweak that formatter.

HTH

 Filename test.properties [Disk] Download
 Description The properties file used in my tests - also what works with the Date format
 Filesize 534 bytes
 Downloaded:  177 time(s)

 Filename jisql.jar [Disk] Download
 Description Source code for my changes
 Filesize 18 Kbytes
 Downloaded:  228 time(s)

This message was edited 2 times. Last update was at 09/27/2006 15:39:48

stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 703
Location: Superior, CO, USA
Offline

Wow! That really expands things. Let me take a look. I think the first thing I have to do is finish my subversion repository implmentation.

Again, let me take a look at this - I think it is a great idea to have.

Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
gnaryak

Newbie

Joined: 09/20/2006 05:42:47
Messages: 3
Offline

I've been continuing to work with this database and seem to have isolated the OutOfMemoryError problem a little more. Contrary to my prior suspicions, I don't think it has anything to do with functions. Rather, I think it is TEXT columns. Consider: CREATE TABLE foo ( id INTEGER, description TEXT );

Running
SELECT * FROM foo;
from jisql causes the OutOfMemoryError, even if there are no rows in the table.
stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 703
Location: Superior, CO, USA
Offline

That makes sense - even if the column gets truncated the program would try to allocate enough memory to read the entire column (!). Depending on your database that could be 2 GB.

I've got several fixes to roll in and this will be right up there in priority.

Is anyone interested in code level access to the subversion repository? It would likely speed up the process if more than one person could work on it.

This message was edited 1 time. Last update was at 10/05/2006 11:39:04


Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
David

Newbie

Joined: 05/23/2007 03:00:21
Messages: 1
Offline

Hi, I happen to have the same problem here. I did a select * from tables; and that gave me the same error, with no stack.

I unfortunately don't have the time to help you with fixing the code, so it's just a message to let you know that yet another developer would appreciate to see the problem solved, and apreciates a lot the work done so far. Thanks for all.
yosei

Newbie

Joined: 03/17/2008 23:06:39
Messages: 1
Offline

Hi,

I have used h2 database(and its JDBC Driver).
I found the problem in below method. It returns 2147483647 in some cases.


And then MemoryOutOfError occurs as below.


 
Forum Index » Jisql
Go to:   
Powered by JForum 2.1.8 © JForum Team
This site built by Scott Dunbar of Xigole Systems. © 2005-2010 - Scott Dunbar
Java and the Java Get Powered logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.
hotjoe.com and xigole.com have no affiliation with Sun Microsystems, Inc.