<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2004-2010 the Seasar Foundation and the Others.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
    either express or implied. See the License for the specific language
    governing permissions and limitations under the License.

-->

<!DOCTYPE components PUBLIC "-//SEASAR2.1//DTD S2Container//EN"
	"http://www.seasar.org/dtd/components21.dtd">
<components namespace="jdbc">
	<include path="jta.dicon"/>
	<include path="jdbc-extension.dicon"/>

	<component class="org.seasar.extension.jdbc.impl.BasicResultSetFactory"/>
	<!--
	<component class="org.seasar.extension.jdbc.impl.OracleResultSetFactory"/>
	-->
	<component class="org.seasar.extension.jdbc.impl.ConfigurableStatementFactory">
		<arg>
			<component class="org.seasar.extension.jdbc.impl.BasicStatementFactory"/>
			<!--
			<component class="org.seasar.extension.jdbc.impl.BooleanToIntStatementFactory"/>
			-->
		</arg>
		<property name="fetchSize">100</property>
		<!--
		<property name="maxRows">100</property>
		-->
	</component>

	<!-- for HSQLDB -->
	<!--
	<component name="xaDataSource"
		class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
		<property name="driverClassName">
			"org.hsqldb.jdbcDriver"
		</property>
		<property name="URL">
			"jdbc:hsqldb:hsql://localhost:9001"
		</property>
		<property name="user">"sa"</property>
		<property name="password">""</property>
	</component>
	-->

	<!-- for H2 -->
	<!--
	<component name="xaDataSource"
		class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
		<property name="driverClassName">
			"org.h2.Driver"
		</property>
		<property name="URL">
			"jdbc:h2:tcp://localhost:9092/demo"
		</property>
		<property name="user">"sa"</property>
		<property name="password">""</property>
	</component>
	-->

	<!-- for Derby -->
	<!--
	<component name="xaDataSource"
		class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
		<property name="driverClassName">
			"org.apache.derby.jdbc.EmbeddedDriver"
		</property>
		<property name="URL">
			"jdbc:derby:demo"
		</property>
		<property name="user">""</property>
		<property name="password">""</property>
	</component>
	-->

	<!-- for Oracle -->
	<!--
	<component name="xaDataSource"
		class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
		<property name="driverClassName">
			"oracle.jdbc.driver.OracleDriver"
		</property>
		<property name="URL">
			"jdbc:oracle:thin:@xxx:1521:xxx"
		</property>
		<property name="user">"xxx"</property>
		<property name="password">"xxx"</property>
		<initMethod name="addProperty">
			<arg>"includeSynonyms"</arg>
			<arg>"true"</arg>
		</initMethod>
	</component>
	-->

	<!-- for PostgreSQL -->
	<!--
	<component name="xaDataSource"
		class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
		<property name="driverClassName">
			"org.postgresql.Driver"
        </property>
        <property name="URL">
          "jdbc:postgresql://localhost/TEST"
        </property>
        <property name="user">"xxxx"</property>
        <property name="password">"xxxx"</property>
    </component>
    -->

	<!-- MySQL
	- MySQL4.0以下でマルチバイト文字を扱う場合には，URL指定の後に，
		以下の接続パラメータを追加で指定してください．
		useUnicode=true
		characterEncoding=[MySQLのエンコーディングに対応した
		Javaのエンコーディング名]
		例："jdbc:mysql://localhost:3306/test?useUnicode=true" +
		"&amp;characterEncoding=Windows-31J"
		
	- MySQL5.0以降で，エンコーディングがeucjpmsの列を扱う場合には，
		URL指定の後に，以下の接続パラメータを追加で指定してください．
		characterEncoding=UTF-8またはWindows-31J
		characterSetResults=UTF-8またはWindows-31J
		例："jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8" +
		"&amp;characterSetResults=UTF-8"
		この指定をしない場合，Java側でUCS-2⇔EUC_JP_Solarisの変換が
		行なわれるため，ユーザー定義外字などの一部の文字が化けます．
		この指定をすることで，MySQL側でeucjpms⇔ucs2⇔utf8(cp932)の
		変換が行なわれ，Java側でUCS-2⇔UTF-8(Windows-31J)の変換が
		行なわれるようになります．この結果，文字化けを防げます．
		なおJIS X 0212(補助漢字)を使用する場合は，Windows-31Jではなく
		UTF-8を指定する必要があります．
		
	- 上記以外の場合は，my.cnfでdefault-character-setの設定を適切に
		(cp932やutf8など．デフォルトのlatin1は不可)行なっていれば，
		文字化けは防げます．
	-->
	<!--
	<component name="xaDataSource"
		class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
		<property name="driverClassName">
			"com.mysql.jdbc.Driver"
		</property>
		<property name="URL">
			"jdbc:mysql://localhost:3306/test"
		</property>
		<property name="user">"xxx"</property>
		<property name="password">"xxx"</property>
	</component>
	-->

	<!-- for SQLServer -->
	<!--
	<component name="xaDataSource"
		class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
		<property name="driverClassName">
			"net.sourceforge.jtds.jdbc.Driver"
        </property>
        <property name="URL">
            "jdbc:jtds:sqlserver://localhost/TEST;instance=SQLEXPRESS"
        </property>
        <property name="user">"xxxx"</property>
        <property name="password">"xxxx"</property>
    </component>
	-->

	<component name="connectionPool"
		class="org.seasar.extension.dbcp.impl.ConnectionPoolImpl">
		<property name="timeout">600</property>
		<property name="maxPoolSize">10</property>
		<property name="allowLocalTx">true</property>
		<destroyMethod name="close"/>
	</component>

	<component name="dataSource"
		class="org.seasar.extension.dbcp.impl.DataSourceImpl"
	/>

	<!-- from JNDI -->
	<!--
	<component name="dataSource"
		class="javax.sql.DataSource">
		@org.seasar.extension.j2ee.JndiResourceLocator@lookup("java:comp/env/jdbc/DataSource")
	</component>
	-->
	
	<!--
	<component name="dataSource"
		class="org.seasar.extension.datasource.impl.SelectableDataSourceProxy"/>
	-->
</components>
