S2JDBCã®iterate()㧠OutOfMemoryError
S2JDBCã使ã£ã¦ DBã®ãã¼ã¿æ°åä¸ä»¶ãã¾ã¨ãã¦DLãããã¨ãããã¨ã©ã¼ã«ãªã£ãã
getResultList()ãããªãã¦iterate()使ã£ããçµæãã¾ã¨ãã¦ä¿æããªããªãããã¡ã¢ãªã使ããªããªãããããªãã®ï¼ã¨æã£ããã©ãã¡ã
Wicketã®ResourceStreamç³»ããã£ãã·ã¥ãã¦ãã®ãèªåã§æ¸ãããªãã¸ã§ã¯ããæ¸ãåºãå¦çããã¹ã£ã¦ãã®ãä½ã使ãæ¹ãééã£ã¦ãã®ãåãããããã£ãã
Eclipse Memory Analyzer ã§ãã³ããè¦ãããã©ããã§ãã¼ã¿ãå
¨ä»¶ä¿æãã¦ãã模æ§ã
2/29 ãããã追è¨
PostgreSQL: http://old.postgresql.jp/wg/jpugdoc/jdbc/jdbc-8.3dev-600/query.html#query-with-cursor http://ml.postgresql.jp/pipermail/pgsql-jp/2005-May/010531.html
MySQL: http://dev.mysql.com/doc/refman/5.1/ja/connector-j-reference-implementation-notes.html
æ´æ°ã®ã¨ãã ããã©ã³ã¶ã¯ã·ã§ã³ãçé¢ç®ã«ãã£ã¦ã表示系ã¯ç¡ãã§ãããã¨æã£ã¦åã«å¤ããã®ã ã£ã⦠*1
è¦ã¦ãããµã¤ãã¯æ
å ±ãå¤ãã or èª¤èª or ééãã§ããorz
大æã®ãµã¼ãã¼(PostgreSQL7.3ã¨ãï¼)ã使ã£ã¦ããã®ã§ãªãéããæ¨æ¥æ¸ããè¨è¿°ã¯ééããåã
ã®DBï¼ãã¼ã¸ã§ã³ãã¨ã«æ³¨æç¹ããããããªã®ã§ãããããã§ãã¯ããå¿
è¦ãããã£ã½ããæ¥è¨ã³ã¡ã³ãããã¯ãã³ã¡ã³ãã®ææå©ããã¾ããã
追è¨ããã 以ä¸ééã
ãããããåå ã¯ããã
S2JDBC ã使ããã«ç´æ¥ JDBC API ãå¼ã³åºãã¦ã¿ã¦ãï¼
PreparedStatement#executeQuery() ã®å¼ã³åºãä¸ã«
OutOfMemoryError ã«ãªã£ã¦ãã¾ãï¼ResultSet ã
è¿ã£ã¦ãã¾ããï¼
ãã®ãã¨ããï¼S2JDBC ã¯é¢ä¿ãªãããã«æããã¾ãï¼ããã MySQL ã®åé¡ãªã®ã Connector/J ã®è¨å®ãªã®ã
http://ml.seasar.org/archives/seasar-user/2008-July/015066.html
ããåããã¾ãããï¼ã¾ã㯠JDBC ç´æ¥å¼ã³åºãã§
çµæãåå¾ããæ¹æ³ã調ã¹ã¦ã¿ã¦ã¯ãããã§ããããï¼
åºç¤ã¨ãªããµã¼ãã¼ãã¹ã¯ãã¼ã«å¯è½ãªã«ã¼ã½ã«ããµãã¼ããã¦ããªãã®
ã§ãã¹ã¯ãã¼ã«å¯è½æ§ã¯å¥ã®ã¬ã¤ã¤ã¼ã§Oracle JDBC ã«ãã£ã¦å®è£ ããå¿ è¦
ãããã¾ãã
ãã®æ©è½ã¯ãã¹ã¯ãã¼ã«å¯è½ãªçµæã»ããã®è¡ãã¯ã©ã¤ã¢ã³ãå´ã®ã¡ã¢ãª
ã¼ã»ãã£ãã·ã¥ã«æ ¼ç´ãããã¨ã«ãããå®ç¾ããã¦ãããã¨ã«æ³¨æãã¦ãã
ãããéè¦:ã¹ã¯ãã¼ã«å¯è½ãªçµæã»ããã®è¡ã¯ãã¹ã¦ãã¯ã©ã¤ã¢ã³ãå´ã®
ãã£ãã·ã¥ã«æ ¼ç´ããã¾ãããã®ãããçµæã»ããã«å¤ãã®è¡ãå¤ãã®å
ã¾ãã¯é常ã«å¤§ããªåãå«ã¾ãã¦ããã¨ãã¯ã©ã¤ã¢ã³ãå´ã®Java Virtual
Machine ã«é害ãçºçããå¯è½æ§ãããã¾ãã大ããªçµæã»ããã«ã¯ã¹ã¯
ãã¼ã«å¯è½æ§ãæå®ããªãã§ãã ãããOracle ãµã¼ãã¼ã®ã¹ã¯ãã¼ã«å¯è½ãªã«ã¼ã½ã«ãããªãã¡ãµã¼ãã¼å´ã®ãã£ã
http://www.oracle.co.jp/forum/thread.jspa?messageID=11006931
ã·ã¥ã¯ãå°æ¥ã®Oracle ãªãªã¼ã¹ã§ãµãã¼ãããã¾ãã
ResultSet
SELECTãå®è¡ããçµæã¯ãResultSetã§åãåãã
next()ã使ã£ã¦çµæã®åã¬ã³ã¼ããå¦çãããã¬ã³ã¼ãå ã®é ç®ã®å¤ã¯ãï¼ãã¼ã¿åã«å¿ãã¦ï¼getString()çã使ã£ã¦åå¾ããã
PostgreSQLã®JDBCãè¿ãResultSetã§ã¯ãè¤æ°ã¬ã³ã¼ããåå¾ããSQLã®å ´åã¯ å ¨çµæãä¸åº¦ã«åãè¾¼ããã¨ãããããã
http://www.ne.jp/asahi/hishidama/home/tech/postgres/jdbc.html
ã¬ã³ã¼ãæ°ãç¡è¶è¦è¶å¤ãï¼ä½åä¸ä»¶ã¨ãä½ç¾ä¸ä»¶ã¨ãã ï¼ã¨ãOutOfMemoryExceptionãçºçããã
å ¨ä½çã«JDBCã¯ããããè¨è¨ï¼
ã¤ã¾ãããããS2JDBCãã¢ããªã§ã¡ã¢ãªã使ããªãããã«ãã¦ãJDBCã®ResultSetãå
¨ä»¶æºãè¾¼ãã§ããã®ã§ã¢ã¦ãã
ä»æ¹ããªãã®ã§å
¨ä»¶åå¾ããã¨ãããlimitã¨offsetã§åå²ãããã®ãç¹ãã¦ã¹ããªã¼ã ã«æ¸ãåºããã¨ã«ããã
ãªããå¾®å¦ã ã