If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > java.sql.SQLException: Out of memory (Needed 268435428 bytes)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-03-07, 03:00
anupam.rajan anupam.rajan is offline
Registered User
 
Join Date: Apr 2007
Posts: 3
Question java.sql.SQLException: Out of memory (Needed 268435428 bytes)

I got exception :
Caused by: java.sql.SQLException: Out of memory (Needed 268435428 bytes)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:2921)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:770)
at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1288)
at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.ja va:2258)
at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:4 21)
at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate
(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java :1384)
at com.mysql.jdbc.ServerPreparedStatement.serverExecu te
(ServerPreparedStatement.java:1133)
at com.mysql.jdbc.ServerPreparedStatement.executeInte rnal
(ServerPreparedStatement.java:670)
at com.mysql.jdbc.PreparedStatement.executeQuery
(PreparedStatement.java:1024)


any idea????
Reply With Quote
  #2 (permalink)  
Old 04-03-07, 06:19
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
sounds to me like you need more memory

since you give no other information, i think that's about as much as i can offer
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 04-03-07, 07:07
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
I would say that your dataset is so large the Java VM is running out of allocated memory, but as r937 clearly states you haven't really provided us with a huge amount of info there. Personally I would check the line numbers provided there.
The number of bytes indicated by the error is 256Mb, so I would hazard a guess that you have a memory leak somewhere... Or your machine just doesn't have enough ram to cope with what you're doing. If your dataset is 256Mb that is pretty darned big...
Reply With Quote
  #4 (permalink)  
Old 04-03-07, 09:40
anupam.rajan anupam.rajan is offline
Registered User
 
Join Date: Apr 2007
Posts: 3
Exclamation

The dataset is not at all big...
As it is not a production DB, it has total 5 tables with not more than 20 records each.
And the exception I said (java.sql.SQLException: Out of memory) is also not coming consistantly.

Initially I too thought that the query might require more memory... but it is very simple select query. This 'Out of memory' seems misleading to me.

Please respond,
Reply With Quote
  #5 (permalink)  
Old 04-03-07, 09:45
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
my version of Microsoft® CrystalBall© says your join conditions are incorrect
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #6 (permalink)  
Old 04-03-07, 10:14
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
I think what r937 is trying to say is post your SQL query and java code please...
Reply With Quote
  #7 (permalink)  
Old 04-04-07, 02:12
anupam.rajan anupam.rajan is offline
Registered User
 
Join Date: Apr 2007
Posts: 3
Question

String loginSql = "SELECT COUNT(event_records_tbl.id) `total login`, " +
"MIN(event_records_tbl.date) `first login`, " +
"MAX(event_records_tbl.date) `last login`, " +
"COUNT(DISTINCT event_records_tbl.date) `days` " +
"FROM event_records_tbl " +
"WHERE event_records_tbl.user_id = ? " +
"AND " +
"event_records_tbl.event_type = ? " +
"AND event_records_tbl.date >= ? " +
"AND event_records_tbl.date <= ? ";
logger.info(loginSql);
PreparedStatement pstmt = conn.prepareStatement(loginSql);
pstmt.setString(1,userName);
pstmt.setString(2,"LOGIN_EVENT");
pstmt.setDate(3,startDate);
pstmt.setDate(4,endDate);
ResultSet rs = pstmt.executeQuery();


the last statement of executeQuery is throwing the said exception.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On