JDBCDebugger
jdbcdebugger¤ÏJDBC¥É¥é¥¤¥Ð¤ÎÆ°ºî¤ò¥Ç¥Ð¥Ã¥°¤¹¤ë¤¿¤á¤ÎJDBC¥É¥é¥¤¥Ð¤Ç¤¹¡£
´û¸¤Î¥·¥¹¥Æ¥à¤Î¥½¡¼¥¹¤ò½¤Àµ¤¹¤ë¤³¤È¤Ê¤¯SQL¡¢SQL¼Â¹Ô»þ´Ö¤òɸ½à½ÐÎϤä¥Õ¥¡¥¤¥ë¤Ë½ÐÎϤ·¤Þ¤¹¡£
SourceForge¤è¤êºÇ¿·¥Ð¡¼¥¸¥ç¥ó¤ò¥À¥¦¥ó¥í¡¼¥É¤·¤Æ¤¯¤À¤µ¤¤¡£
°ÊÁ°JDBC¤òÍøÍѤ¹¤ëWEB¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò³«È¯¤·¤Þ¤·¤¿¡£¤½¤Î¸åSQL¤Î¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤ò¥Á¥§¥Ã¥¯¤¹¤ë¤¿¤á¤Ë¡¢SQL¤Î¼Â¹Ô¥í¥°¤ò½ÐÎϤ¹¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤·¤¿¡£
¤¬¡¢¥½¡¼¥¹¤Ë½ÐÎϽèÍý¤òÄɲ乤ë¤Î¤Ï¹½Â¤Åª¤Ë¤«¤Ê¤êÂçÊѤÀ¤Ã¤¿¤¿¤á¡¢JDBC¥É¥é¥¤¥Ð¤òºîÀ®¤·¥í¥°¤òºîÀ®¤¹¤ë¤³¤È¤È¤·¤Þ¤·¤¿¡£¥Ç¥Ð¥Ã¥°ÍѤȤ·¤Æ¤·¤«ÍøÍѤ·¤Æ¤¤¤Þ¤»¤ó¤¬¡¢¤Ê¤«¤Ê¤«²÷Ŭ¤Ç¤¹¡£
¤³¤Î¤è¤¦¤Ê¥í¥°¤òɸ½à½ÐÎϤ«¥Õ¥¡¥¤¥ë¤Ë½ÐÎϤ·¤Þ¤¹¡£
## JDBC Debug ## 2003/10/01 18:07:45 71ms executeQuery SELECT xxxxOID,xxxxDate FROM UserMst
2003/10/01 18:07:45 ¼Â¹ÔÆü»þ
71ms ±þÅú»þ´Ö+¥Ç¡¼¥¿¼èÆÀ»þ´Ö
executeQuery ¼Â¹Ô¥á¥½¥Ã¥É
SELECT ... ¼Â¹ÔSQL
¢¨ver0.09¤«¤éjdbcdebug.properties¤òÇѻߤ·¤Þ¤·¤¿¡£ ¡¡Á´¤ÆJDBC URL¤Ç¥Ñ¥é¥á¡¼¥¿¤ò»ØÄꤷ¤Þ¤¹¡£ (1) jdbcdebug_X.XX.jar ¤ÎÇÛÃÖ< ¥¯¥é¥¹¥Ñ¥¹¤Ë jdbcdebug_X.XX.jar ¤ò¥³¥Ô¡¼¤·¤Æ¤¯¤À¤µ¤¤¡£ JNDI¤òÍøÍѤ·¤Ê¤¤¾ì¹ç¤Ï /WEB-INF/lib/jdbcdebug_X.XX.jar Åù¤ËÇÛÃÖ¤·¤Þ¤¹¡£ JNDI¤òÍøÍѤ¹¤ë¾ì¹ç¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥µ¡¼¥Ð¡¼¤Î¥¯¥é¥¹¥Ñ¥¹¤ËÇÛÃÖ¤·¤Þ¤¹¡£ Îã¤È¤·¤ÆTOMCAT¤Î¾ì¹ç¤Ï $TOMCAT_HOME/common/lib/jdbcdebug_X.XX.jar ¤ËÇÛÃÖ¤·¤Þ¤¹¡£ (2) JDBC¥É¥é¥¤¥Ð¤ÎÊѹ¹ ¥Ç¥Ð¥Ã¥°¤·¤¿¤¤¥·¥¹¥Æ¥à¤Ç¤Ï´û¤Ë Oracle Åù¤Î ¥É¥é¥¤¥Ð¤òÍøÍѤ·¤Æ¤¤¤ë¤È»×¤ï¤ì¤Þ¤¹¡£ ¤³¤ì¤ò JDBC Debug ¤ËÊѹ¹¤·¤Æ¤¯¤À¤µ¤¤¡£ Îã)JNDI¤Î¾ì¹ç¤âƱÍͤ˥ɥ饤¥Ð¤Î»ØÄê¤òÊѹ¹¤·¤Æ¤¯¤À¤µ¤¤¡£ (3) ÀܳURL¤ÎÊѹ¹ JDBCÀܳURL¤ò [¼ÂºÝ¤ÎURL]?jdDriver=[¼ÂºÝ¤Î¥É¥é¥¤¥Ð]&jdOutType=1&jdPrefix=#SQL# ¤ËÊѹ¹¤·¤Þ¤¹¡£ PostgreSQL¤Î¾ì¹ç¡Ë[URL¥ª¥×¥·¥ç¥ó¤Ë¤Ä¤¤¤Æ] jdDriver ¼ÂºÝ¤ÎJDBC¥É¥é¥¤¥Ð¡£É¬¿Ü jdOutType ¥í¥°½ÐÎÏ¥¿¥¤¥×¡£Ç¤°Õ¡£ 1:ɸ½à½ÐÎÏ, 2:¥Õ¥¡¥¤¥ë(̤Âбþ), 3:Log4J (DEBUG¥ì¥Ù¥ë) jdPrefix ¥í¥°ÀÜƬ¼¡£Ç¤°Õ ¤³¤ì¤Ç´°Î»¤Ç¤¹¡£ ¸å¤Ïº£¤Þ¤ÇÄ̤ꥷ¥¹¥Æ¥à¤ò¼Â¹Ô¤¹¤ë¤ÈSQL¥í¥°¤¬ ½ÐÎϤµ¤ì¤Þ¤¹¡£ ¢¨¥í¥°¤ÏSQL¼Â¹Ôľ¸å¤Ë½ÐÎϤµ¤ì¤Þ¤¹¡£ <<<< ¥í¥°¥Õ¥©¡¼¥Þ¥Ã¥È >>>>jdbc:postgresql://129.160.48.82/FWPRJ?jdDriver=org.postgresql.Driver&jdOutType=1&jdPrefix=#SQL#
#SQL# ÀÜƬ¼(jdPrefix¤ËŬÅö¤Êʸ»ú¤òÍ¿¤¨¤Æ¤¯¤À¤µ¤¤¡Ë 2003/10/01 18:07:18 ¥í¥°½ÐÎÏÆü»þ¡ÊSQL¼Â¹Ôľ¸å¤ÎÆü»þ) 0ms SQL±þÅú»þ´Ö+¥Ç¡¼¥¿¼èÆÀ»þ´Ö(executeQuery Åù¤Î¥á¥½¥Ã¥É¼Â¹Ô»þ´Ö)[ms] executeQuery ¼Â¹Ô¥á¥½¥Ã¥É̾(execute, executeQuery, executeUpdate) SELECT °Ê¹ß ¼Â¹ÔSQL <<<< ²òÀÏ¥¯¥é¥¹¡¦¥á¥½¥Ã¥É >>>> java.sql.Statement, java.sql.PreparedStatement ¤Î SQL¼Â¹Ô¥á¥½¥Ã¥É¼Â¹Ô»þ¤Ë¥í¥°¤ò½ÐÎϤ·¤Æ¤¤¤Þ¤¹¡£ ¡Êjava.sql.CallableStatement ¤Ï²òÀϤ·¤Æ¤¤¤Ê¤¤¤Î¤Ç ¥í¥°¤Ë½ÐÎϤµ¤ì¤Þ¤»¤ó¡£¡Ë#SQL# 2003/10/01 18:07:18 10ms executeQuery SELECT userID FROM MstUser WHERE userName = 'aaa'
jdbcdebug_x.xx.jar¤Ï´ðËÜŪ¤Ë java.sql ¥Ñ¥Ã¥±¡¼¥¸°Ê²¼¤ÎInterface¤ò¼ÂÁõ¤·¤¿¥¯¥é¥¹·²¤Ç¤¹¡£
¡£¤³¤ì¤é¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ÈOracleÅù¤Î¥Ù¥ó¥À¡¼À½JDBC¥É¥é¥¤¥Ð¤Î´Ö¤ÇÆ°ºî¤·¡¢ SQL¼Â¹Ô¥á¥½¥Ã¥É¼Â¹Ô»þ¤Ë¥í¥°¤ò½ÐÎϤ·¤Þ¤¹¡£
¤Ä¤Þ¤ê¡¢jdbcdebugger¤ÏJDBC¥É¥é¥¤¥Ð¤ò¥é¥Ã¥×¤·¡¢É¬Íפ˱þ¤¸¤ÆÆ°ºî²òÀϽèÍý¤òÄɲ䷤Ƥ¤¤Þ¤¹¡£
ƳÆþÁ° ƳÆþ¸åjdbcdebugger ¤Ï¥Ù¥ó¥À¡¼JDBC¥É¥é¥¤¥Ð¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òjava.sql¥Ñ¥Ã¥±¡¼¥¸¤Î¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹·¿¤ÇÊÝ»ý¤·¤Þ¤¹¡£
¤½¤·¤Æ¥³¥Í¥¯¥·¥ç¥ó¡¢¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤ò´ÉÍý¤·¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬SQL¼Â¹Ô¥á¥½¥Ã¥É (executeQuery, executeUpdate) ¤ò¼Â¹Ô¤¹¤ë¤È¡¢¤Þ¤º¸½ºß»þ¹ï¤òmsñ°Ì¤Ç¼èÆÀ¤·¡¢¥Ù¥ó¥À¡¼¤ÎJDBC¥É¥é¥¤¥Ð¤Ë¤½¤Î¤Þ¤ÞSQL¤òÅϤ·¡¢SQL¼Â¹Ô¥á¥½¥Ã¥É´°Î»¸å¤Î»þ´Ö¤«¤é±þÅú+¼èÆÀ»þ´Ö¤ò·×»»¤·¤Þ¤¹¡£¤½¤·¤ÆSQL¤È±þÅú+¼èÆÀ»þ´Ö¤ò¥í¥°¤Ë½ÐÎϤ·¤Þ¤¹¡£
¤½¤Î¾¤Ï¥Ù¥ó¥À¡¼JDBC¥É¥é¥¤¥Ð¤Ë¤½¤Î¤Þ¤Þ½èÍý¤ò¥Ý¥¹¥È¤·¤Æ¤¤¤Þ¤¹¡£
¥Ç¥¶¥¤¥ó¥Ñ¥¿¡¼¥óŪ¤Ë¤Ïjdbcdebugger¤¬JDBC¥É¥é¥¤¥Ð¤òDelegate¤·¤Æ¤¤¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
ÍøÍѤ¹¤ë¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥µ¥ó¥×¥ë¤Ç¤¹¡£Ä̾ï¤ÎJDBC¥µ¥ó¥×¥ë¤ÈÁ´¤¯Æ±¤¸¤Ç¤¹¡£ ¡£
import java.sql.*; import java.util.Properties; public class JDBCDebugTest002 { public JDBCDebugTest002() { } public static void main(String args[]) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { Driver db_driver = (Driver)Class.forName("jp.co.powerbeans.jdbcdebug.sql.Driver").newInstance(); Properties props = new Properties(); props.put("user", "oracle"); // user name props.put("password", "password"); // password Connection c = db_driver.connect("jdbc:oracle:thin:@localhost:1521:global", props); PreparedStatement pst = c.prepareStatement("select * from softMst"); ResultSet rs = pst.executeQuery(); rs.close(); pst.close(); c.close(); } }
JDK1.4.0 °Ê¹ßÂбþ(1.3°ÊÁ°¤Ï̤³Îǧ)
DBMSÀ½ÉÊ̾ | Æ°ºî |
Oracle 8.1.7, 9i | ¡û |
MySQL 4.0.1°Ê¹ß | ¡û |
PostagreSQL | ¡û |
DB2 | ¡û |
HSQLDB | ¡û |
¤Þ¤¿¡¢³«È¯¼Ô¤Î»²²Ã¤â¤ªÂÔ¤Á¤·¤Æ¤¤¤Þ¤¹¡£
²¿¤«Í×˾¤¬¤¢¤ê¤Þ¤·¤¿¤éµ¤·Ú¤Ë¥á¡¼¥ë¤·¤Æ¤¯¤À¤µ¤¤¡£
Åê¹Æ¤µ¤ì¤¿ÆâÍƤÎÃøºî¸¢¤Ï¥³¥á¥ó¥È¤ÎÅê¹Æ¼Ô¤Ëµ¢Â°¤·¤Þ¤¹¡£