JBoss Advent Calendar 2011ã®14æ¥ç®ã®ã¨ã³ããªã§ããä»æ¥ã¯JDBC XAãã¼ã¿ã½ã¼ã¹ã®èª¬æã XAã£ã¦ãªã«ãï¼ ãã¼ãã§ã¼ãºã³ããã(2ç¸ã³ããã, 2PC)ããããã®ã¤ã³ã¿ãã§ã¼ã¹ã§ãã XAã¨ã2PCã£ã¦ã©ããªã¨ãã«ä½¿ãã®ï¼ ä¸ã¤ã®ãã©ã³ã¶ã¯ã·ã§ã³ã§2ã¤ä»¥ä¸ã®ãã©ã³ã¶ã¯ã·ã§ãã«ãªã½ã¼ã¹(JDBC JCAãªã½ã¼ã¹ã¢ããã¿=ãã¼ã¿ãã¼ã¹ã¨ããJMS JCAãªã½ã¼ã¹ã¢ããã¿ã¨ã)ãæ±ãå ´åã«å©ç¨ãã¾ãã XAã¨ã2PCã£ã¦ãªãã§å¿ è¦ãªã®ï¼ ä¾ãã°ãã¼ã¿ãã¼ã¹ãäºã¤ãDB-Aã¨DB-Bããã£ã¦ãDB-AããDB-Bã«ãã¼ã¿ã移ãå¦çãããã¨ãã¾ãããã®ã¨ããDB-AããSELECTãã¦åé¤ãã¦DB-Bã«ã¤ã³ãµã¼ããããã¨ãããããªãã¨ãããããã§ããããã®å¦çãéä¸ã§è½ã¡ããå³ãã¼ã¿æ¶æ» ããã¼ã¿éè¤ãªã©ã®ãã¼ã¿ä¸æ´åã¨ããçµæã«ãªã£ã¦ãã¾ãã¾ããXAã使ãã¨ãããã£ã
Commons DBCPãè¶ ããTomcat JDBC Poolã¨ã¯ï¼Tomcat 7ã®æ°æ©è½ã§ä½ãã§ããããã«ãªãã®ãï¼ï¼çªå¤ç·¨ï¼ï¼1/2 ãã¼ã¸ï¼ Tomcatã®DBã³ãã¯ã·ã§ã³ã»ãã¼ã«ã¯2ã¤ãã ï¼ ITèªè ã®çããã¯ãTomcat JDBC Connection Poolãããåãã§ããï¼ é常ãTomcatã®DBã³ãã¯ã·ã§ã³ã»ãã¼ã«ã¨ããã°Apache Commonsããã¸ã§ã¯ãã®ãCommons DBCPããæ³åãããã¨æãã¾ããããããTomcatã«ã¯ãCommons DBCPã以å¤ã«ãDBã³ãã¯ã·ã§ã³ã»ãã¼ã«ã®å®è£ ãåå¨ãã¾ãããããããTomcat JDBC Connection Poolãï¼ä»¥ä¸ãTomcat JDBC Poolï¼ã§ãã Tomcat JDBC Poolã¨ã¯ãApache Tomcatããã¸ã§ã¯ããç¬èªã«ä½æããDBã³ãã¯ã·ã§ã³ã»ãã¼ã«ã®å®è£ ã®ãã¨ã§ãã
C JDBCã¨ã©ã¼ã»ã¡ãã»ã¼ã¸ ãã®ä»é²ã§ã¯ãJava Database Connectivityï¼JDBCï¼ã¨ã©ã¼ã»ã¡ãã»ã¼ã¸ã®ä¸è¬æ§é ã«ã¤ãã¦èª¬æããOracle JDBCãã©ã¤ãã«ãã£ã¦æ»ããããã¨ãããä¸è¬JDBCã¨ã©ã¼ã»ã¡ãã»ã¼ã¸ã¨TTCã¨ã©ã¼ã»ã¡ãã»ã¼ã¸ããªã¹ããã¾ãããã®ä»é²ã«ã¯ã次ã®é ç®ãå«ã¾ãã¾ãã JDBCã¨ã©ã¼ã»ã¡ãã»ã¼ã¸ã®ä¸è¬æ§é ä¸è¬JDBCã¡ãã»ã¼ã¸ ãã¤ãã£ãXAã¡ãã»ã¼ã¸ TTCã¡ãã»ã¼ã¸ ã¡ãã»ã¼ã¸ã»ãªã¹ãã¯ãããããã¯ããã«ORAçªå·é ã次ã«äºåé³é ã«ã½ã¼ãããã¦ãã¾ãã JDBCã¨ã©ã¼ã»ã¡ãã»ã¼ã¸ã®ä¸è¬æ§é ä¸è¬JDBCã¨ã©ã¼ã»ã¡ãã»ã¼ã¸æ§é ã§ã¯ã次ã®ããã«ã¡ãã»ã¼ã¸ã®æ«å°¾ã«ã³ãã³ãä»ãã¦ãã©ã³ã¿ã¤ã æ å ±ã追å ã§ãã¾ãã <error_message>:<extra_info> ãã¨ãã°ããclosed statementãã¨ã©ã¼ã¯æ¬¡ã®ããã«åºåããã
以ä¸ã§ç´¹ä»ããã¦ããOracle JDBCã®Java.sql.PreparedStatement#setString()ã®å¶éã«ã¤ãã¦ã [Oracle] JDBCã§ãã¤ã³ãã§ããæååã®ãµã¤ãºã®å¶é | Archive Redo Blog ä¾ãã°ãã¼ã¿ãã¼ã¹ãã£ã©ã¯ã¿ã»ãããJA16SJISã®DBã«varchar2(4000)ã®åããã£ãã¨ãã¦ããPreparedStatment#setString()ã§ã¯UTF-8æç®ã§2000ãã¤ãã¾ã§ããæ¿å ¥ã§ããªãã UTF-8ã¯æ¥æ¬èªã3ãã¤ããªã®ã§ãå ¨ã¦æ¥æ¬èªã®å ´åã ã¨666æåã¾ã§ããå ¥ããªãã¨ããåé¡ãããã¾ãã ä¸è¨ã®ãã¼ã¸ã§ã¯setCharacterStream()ã使ã£ã¦è§£æ±ºã¨ãã¦ãã¾ããã 以ä¸ã®ãã¼ã¸ã§ã¯ã¾ãå¥ã®åé¡ãèµ·ãããã¨ãæå®ãã¦ãã¾ãã http://rryu.sakura.ne.jp/nisenise-fuhito/
Java.sql.PreparedStatementã¤ã³ã¿ã¼ãã§ã¼ã¹ã使ç¨ãã¦Oracleãã¼ã¿ãã¼ã¹ã«ãã¼ã¿ãç»é²ããéãsetString()ã¡ã½ããã使ç¨ãã¦ãã¤ã³ãã§ããæååã®ãµã¤ãºã«ã¯å¶éãããããã§ãã Oracleãã¼ã¿ãã¼ã¹ã¨ãã¦ã®ãã¤ã³ããµã¤ãºã®ä¸éã¯VARCHAR2ãNVARCHAR2ã®æ大ãµã¤ãºï¼4000ãã¤ãï¼ã¨åããªã®ã§ãããOracle JDBCãã©ã¤ãã§PreparedStatementã¤ã³ã¿ã¼ãã§ã¼ã¹ã®setString()ã¡ã½ããã使ç¨ããå ´åã使ç¨ãã¦ãããã£ã©ã¯ã¿ã»ã»ããã«ãã£ã¦ããå³ãããµã¤ãºå¶éã課ããããããã§ãã ãOracle9i JDBCéçºè ã¬ã¤ãããã³ãªãã¡ã¬ã³ã¹2(9.2)ãã®ä¸ã®ãThinãã©ã¤ãã«ããSQL CHAR ãã¼ã¿ã»ãµã¤ãºå¶éãã¨ãããããã¯ã§è§£èª¬ããã¦ããå 容ãè¦ãã¨ããã¼ã¿ãã¼ã¹ã»ãã£ã©ã¯ã¿ã»ãããJA16SJIS
S2Unitã¯DBã使ã£ãã¦ããããã¹ãã®æ¯æ´æ©è½ã¨ãã¦Excelãã¡ã¤ã«ããDBã«ãã¹ãç¨ãã¼ã¿ãæå ¥ããããExcelãã¡ã¤ã«ã¨DBã®å 容ãæ¯è¼ããããããã¨ãã§ãã¾ãããã ãå®éã«ãã£ã¦ã¿ãã¨ãããã®ã§ãããã®Excelãã¡ã¤ã«ã®ã¡ã³ããã³ã¹ã³ã¹ãã馬鹿ã«ãªãã¾ããã ããã§ãå®éã«DBã«ã¢ã¯ã»ã¹ããã®ã§ã¯ãªãããã¬ã¼ã ã¯ã¼ã¯ãJDBCãã©ã¤ãã®ã¬ã¤ã¤ã§çºè¡ãããSQLã横åãããæå¾ éãã®SQLãçºè¡ãããã®ãã©ããã確èªããã¨ããæ¹æ³ã¯ã©ãã ããï¼ã¨èãã¾ãããããããã©ã¤ãã©ãªãèªä½ããããã¨ãæã£ãã®ã§ããï¼å®ééä¸ã¾ã§ä½ã£ã¦ããã®ã§ããï¼ãä¸ã®ä¸åããã¨ãèãã人ã¯ãããã®ã§ãMockRunnerã®JDBC Mockã¨ããæ©è½ã使ãã¨ãã®ãã®ãºããªãªãã¨ãã§ããããã§ãã http://mockrunner.sourceforge.net/examplesjdbc.html
ãã®é£è¼ã§ã¯ãJavaã®ãã¼ã¿ãã¼ã¹ã»ã¢ã¯ã»ã¹APIã§ãããJDBCãã®æ©è½ãããµã³ãã«ã³ã¼ãã交ãã¦è§£èª¬ãã¦ããã¾ããã¾ããJ2EEã«ãããJDBCã®ä½ç½®ä»ãããJDBCãå©ç¨ãããã¾ãã¾ãªãã¯ããã¸ã«ã¤ãã¦ã解説ãã¦ããäºå®ã§ããåæç¥èã¨ãã¦ã¯ãJavaã¨ãªã¬ã¼ã·ã§ãã«ã»ãã¼ã¿ãã¼ã¹ã«é¢ãããã¼ã·ãã¯ãªç¥èãããã°ååã§ãã ä»åã¯ãJDBCã®æ¦è¦ã«ã¤ãã¦ç°¡åã«è§¦ããå¾ãJDBCã®ã¢ã¼ããã¯ãã£ã«ã¤ãã¦è§£èª¬ãã¾ãã JDBCã¨ã¯? JDBCã¯ãä¸è¨ã§ãã£ã¦ãã¾ããªãããªã¬ã¼ã·ã§ãã«ã»ãã¼ã¿ãã¼ã¹ï¼ããã³ãã»ã¨ãã©ãã¹ã¦ã®è¡¨å½¢å¼ã®ãã¼ã¿ï¼ã«ã¢ã¯ã»ã¹ããããã®ãæ¨æºJava APIãã§ããJDBCã¯ãJava Database Connectivityãã®çç¥ã ã¨ãããã¦ãã¾ãï¼ããå®ã¯JDBCä»æ§ã«ã¯æè¨ããã¦ãã¾ããï¼ã ä¼æ¥å ã®ã¯ãªãã£ã«ã«ãªãã¼ã¿ã¯ãå¤ãã®å ´åãªã¬ã¼ã·ã§ãã«ã»ãã¼
é常ãèªåã³ãããããªãã®ç¶æ ã§ããã°ãJavaããDBã®ã³ãã¯ã·ã§ã³ãã¯ãã¼ãºããã¨ãã«ãã¼ã«ããã¯ãããã«ç¸å½ããå¦çãè¡ããã¾ãã Javaã®ããã¥ã¡ã³ãã«ãããã®ãã¨ãæ¸ããã¦ãã¾ãã èªåã³ãããã¢ã¼ããç¡å¹ã«ããã¦ããå ´åãå¤æ´ãã³ãããããã«ã¯ commit ã¡ã½ãããæ示çã«å¼ã³åºãå¿ è¦ãããã¾ããããããªãã¨ãã¼ã¿ãã¼ã¹ã®å¤æ´ã¯ä¿åããã¾ããã Oracle Technology Network for Java Developers | Oracle Technology Network | Oracle ã¨ãããã»ã»ã» èªåã³ãããã»ã¢ã¼ãã使ç¨ç¦æ¢ã«ãã¦ãç´åã®å¤æ´ãæ示çã«ã³ãããã¾ãã¯ãã¼ã«ããã¯ããã«æ¥ç¶ãã¯ãã¼ãºããå ´åã¯ãæé»çãªCOMMITæä½ãå®è¡ããã¾ãã*1 3.åºæ¬æ©è½ - Oracle Database JDBCéçºè ã¬ã¤ãããã³ãªãã¡ã¬ã³ã¹
Tomcatã§ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ã使ç¨ãã¦ãã¦ãTomcat <-> Oracleéã®æ¥ç¶ãFINãRSTãã±ããã«ããéç¥ãªãã«åãããå ´åããã¼ã«ãã¦ããæ¥ç¶ãå®éã«ã¯æ»ãã§ããç¶æ ãçºçãããä¾ãã°ã以ä¸ã®ãããªå ´åã«çºçããã APãµã¼ãã¼ <-> DBãµã¼ãã¼éã®Firewallã«ããã»ãã·ã§ã³åæ DBãµã¼ãã¼ã®ãªãã¼ã(Windows Server 2008ã®å ´åãä»ã¯æªç¢ºèª) ãªããWindows Server 2008ã§è©¦ããéãã§ã¯Oracleãµã¼ãã¹ã®åèµ·åãshutdownãstartupã®å ´åã¯çºçããªãã£ããããããFINã¾ãã¯RSTãã±ãããé£ãã§ããã¨æãããã ä¸åº¦ããã®ç¶æ ã«é¥ãã¨ããã®å¾ãããã¯ã¼ã¯ãDBãµã¼ãã¼ã復æ§ãã¦ãæ»ãã æ¥ç¶ããã¼ã«ã«æ®ãç¶ãããã®æ¥ç¶ã使ç¨ããTomcatã®ã¹ã¬ããã¯SQLãå®è¡ããå¦çã§Oracleããã®å¿çããã£ã¨å¾
http://d.hatena.ne.jp/muimy/20100918/1284812424 ã®ã¤ã¥ã ã©ãããWEB-INF/libã«JDBCãã©ã¤ãç½®ããã«ãTomcatã®libã«ç½®ããããæãããªãããã æ±ç¨çãªãã¤ãTomcatãåæã«å¼ãã§ãããªãã®ã¯ãã¯ã©ã¹ãã¼ãã¼ããã¿ã®åé¡ã½ãã registerDriverããã®ã¨unregisterDriverããã®ã¯åãã¯ã©ã¹ãã¼ãã¼ã§ããå¿ è¦ãããã¨ã Tomcatã®ã½ã¼ã¹ã¡ãã£ã¨è¿½ã£ã¦ã¿ãããè¦åãåºãã¦ããã®ã¯ã Tomcatã®WebappClassLoader#clearReferencesJdbcã¡ã½ããå ã®ä»¥ä¸ã®é¨å for (String name : driverNames) { log.error(sm.getString("webappClassLoader.clearJbdc", contextName, n
Tomcatä¸ã§ãæã¯æå¥è¨ãããã«åãã¦ãWebã¢ããªããæè¿åããããããªãã¼ãæã«æãããããã«ãªã£ãããããªã¡ãã»ã¼ã¸ãã§ãã è´å½ç: The web application [/hogehoge] registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. ããã£ã¦ã¿ãã¨ãå èDBCPã®ãã°ã ãããåã¯æªããªãï¼ã»ã£ã¨ãï¼ã£ã¦ããã®ããã£ã¦ãã¡ãã£ã¨ããã¨ããã http://stackoverflow.com/questions/3320400/jdbc-dr
2010å¹´2æ8æ¥ at 12:21 åå¾ 1件ã®ã³ã¡ã³ã GlassFishã¯ãã¼ã¿ãã¼ã¹ã¨ã®æ¥ç¶ã«ãã¼ã¿ãã¼ã¹ãã³ãã¼ãæä¾ããJDBCãã©ã¤ãã使ç¨ãã¾ãï¼ GlassFishã«ã¯ã¤ã³ã¹ãã¼ã«æããã©ã«ã㧠Java DBãä»å±ãã¦ããï¼ãããããJava DBã«å¯¾ããJDBCãªã½ã¼ã¹ã¨æ¥ç¶ãã¼ã«ã®è¨å®ãããã¦ãã¾ãï¼ãã㦠GlassFish ã®ç£è¦ç³»ã®æ©è½ã®ä¸ã¤ã§ããï¼ãå¼ã³åºãããã¼ãã®ãã¼ã¿ä¿åå ã¨ãã¦ä½¿ç¨ããã¦ãã¾ãï¼ ããã§ã¯ï¼æ°ãã«MySQL 5.1ã¨ã®æ¥ç¶è¨å®æ¹æ³ã«ã¤ãã¦ç´¹ä»ãã¾ãï¼MySQLã¨æ¥ç¶ããããã«ã¯ï¼MySQLã®JDBCãã©ã¤ããäºåã«å ¥æãã¦ããã¦ãã ããï¼ ã¾ã以éã®æé ã§ã¯MySQLãæ¢ã«ã¤ã³ã¹ãã¼ã«ããã¦ãããã¨ãåæã«èª¬æãã¾ãï¼ JDBCãã©ã¤ãã«å¯¾ããã¯ã©ã¹ãã¹ãè¨å® dashost > asadmin get âcluster1-confi
http://d.hatena.ne.jp/amutan/20090222/1235300928 http://d.hatena.ne.jp/amutan/20090222/1235300058 http://d.hatena.ne.jp/amutan/20090224/1235487682 èªåã®ãããªJDBCã¨æ ¼éãã人ã«ã¨ã£ã¦ ãã¾ãã«ç´ æ´ãããè²´éãªè¨äºãè¦ã¤ãã¾ããã®ã§ã ããã«åå¿é²ã¨ãã¦ã¡ã¢ããã¦é ãã¾ãã
SQLã®LIKEç¯ã§ã¯%(ãã¼ã»ã³ãè¨å·)ã¨_(ã¢ã³ãã¼ã¹ã³ã¢)ã¯ã¡ã¿æåã¨æ±ããã¾ããJDBCã¯ããçã®æåããªãã©ã«çã«è§£éãããããã®æ§æãç¨æãã¦ãã¾ããLIKEå¼ã®ç´å¾ã«ç¶ãJDBCã®ç¯ã§ã¯ãã¨ã¹ã±ã¼ãæåãæå®ãããã¨ãã§ãã¾ãã
ã©ã³ãã³ã°
ã¡ã³ããã³ã¹
ãç¥ãã
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}