geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Forrest Xia <forres...@gmail.com>
Subject Re: MySQL Broken Pipe
Date Mon, 07 Dec 2009 02:12:22 GMT
Or another way to set autoReconnect=true via the general tranql adapter.
Here is an example about it:
1. Install the mysql jdbc driver to geronimo repository. You can install it
via admin console->services->repository, and set it module id, for example,
mysql/mysql-connector-java/3.1.12/jar
2. Create a connector plan file "plan.xml" like follows:
<?xml version="1.0" encoding="UTF-8"?>
    <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
    <environment>
        <moduleId>
            <groupId>default</groupId>
            <artifactId>myds</artifactId>
            <version>1.0</version>
            <type>car</type>
        </moduleId>
    <dependencies>
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>3.1.12</version>
                <type>jar</type>
            </dependency>
        </dependencies>
    </environment>
    <resourceadapter>
        <outbound-resourceadapter>
            <connection-definition>

<connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
                <connectiondefinition-instance>
                    <name>jdbc/myds</name>
                    <config-property-setting
name="Driver">com.mysql.jdbc.Driver</config-property-setting>
                    *<!--You can append any mysql jdbc connection property
after ? delimited by & -->*
                    *<config-property-setting
name="ConnectionURL">jdbc:mysql://localhost:3306/mydb?autoReconnect=true</config-property-setting>
*
                    <config-property-setting
name="UserName">root</config-property-setting>
                    <config-property-setting
name="Password">password</config-property-setting>
                    <connectionmanager>
                        <local-transaction/>
                        <single-pool>
                            <max-size>10</max-size>
                            <min-size>0</min-size>
                            <select-one-assume-match/>
                        </single-pool>
                    </connectionmanager>
                </connectiondefinition-instance>
            </connection-definition>
        </outbound-resourceadapter>
    </resourceadapter>
</connector>

In this plan, you can add any jdbc property in the ConnectionURL
config-property-setting.
3. Deploy this plan via deploy.sh|bat command like follows:
 <GERONIMO_HOME>/bin/deploy.sh deploy
repository/org/tranql/tranql-connector-ra/1.4/tranql-connector-ra-1.4.rar
<PathToThePlan>/plan.xml
4. Then use this data source in your application.

Forrest

Mime
View raw message