List:Commits« Previous MessageNext Message »
From:mcbrown Date:March 23 2007 7:32am
Subject:svn commit - mysqldoc@docsrva: r5514 - trunk/refman-common
View as plain text  
Author: mcbrown
Date: 2007-03-23 08:32:51 +0100 (Fri, 23 Mar 2007)
New Revision: 5514

Log:
Adding Spring/JDBC examples from Jess 



Modified:
   trunk/refman-common/connector-j.xml


Modified: trunk/refman-common/connector-j.xml
===================================================================
--- trunk/refman-common/connector-j.xml	2007-03-23 07:18:53 UTC (rev 5513)
+++ trunk/refman-common/connector-j.xml	2007-03-23 07:32:51 UTC (rev 5514)
Changed blocks: 21, Lines Added: 515, Lines Deleted: 956; 63210 bytes

@@ -240,8 +240,8 @@
 
       <para>
         You will need to use the appropriate graphical or command-line
-        utility to un-archive the distribution (for example, WinZip for
-        the .zip archive, and <command>tar</command> for the .tar.gz
+        utility to extract the distribution (for example, WinZip for the
+        .zip archive, and <command>tar</command> for the .tar.gz
         archive). Because there are potentially long filenames in the
         distribution, we use the GNU tar archive format. You will need
         to use GNU tar (or an application that understands the GNU tar

@@ -273,7 +273,7 @@
 
       <para>
         You can set the <literal>CLASSPATH</literal> environment
-        variableunder UNIX, Linux or Mac OS X either locally for a user
+        variable under UNIX, Linux or Mac OS X either locally for a user
         within their <literal>.profile</literal>,
         <literal>.login</literal> or other login file. You can also set
         it globally by editing the global

@@ -1045,16 +1045,16 @@
         <para>
           <informaltable>
             <tgroup cols="4">
-              <colspec colwidth="30*" colname="cj_propstbl_prop_name"/>
-              <colspec colwidth="50*" colname="cj_propstbl_prop_defn"/>
-              <colspec colwidth="10*" colname="cj_propstbl_default"/>
-              <colspec colwidth="10*" colname="cj_propstbl_since_version"/>
+              <colspec colwidth="30*" colname="cj_propstbl_prop_name" />
+              <colspec colwidth="50*" colname="cj_propstbl_prop_defn" />
+              <colspec colwidth="10*" colname="cj_propstbl_default" />
+              <colspec colwidth="10*" colname="cj_propstbl_since_version" />
               <tbody>
                 <row>
-                  <entry><emphasis role="bold"> Property Name </emphasis></entry>
-                  <entry><emphasis role="bold"> Definition </emphasis></entry>
-                  <entry><emphasis role="bold"> Default Value </emphasis></entry>
-                  <entry><emphasis role="bold"> Since Version </emphasis></entry>
+                  <entry><emphasis role="bold">Property Name</emphasis></entry>
+                  <entry><emphasis role="bold">Definition</emphasis></entry>
+                  <entry><emphasis role="bold">Default Value</emphasis></entry>
+                  <entry><emphasis role="bold">Since Version</emphasis></entry>
                 </row>
                 <row>
                   <entry>user</entry>

@@ -1108,14 +1108,6 @@
                   <entry>3.1.0</entry>
                 </row>
                 <row>
-                  <entry>localSocketAddress</entry>
-                  <entry>Hostname or IP address given to explicitly configure the interface that
-                    the driver will bind the client side of the TCP/IP
-                    connection to when connecting.</entry>
-                  <entry></entry>
-                  <entry>5.0.5</entry>
-                </row>
-                <row>
                   <entry>propertiesTransform</entry>
                   <entry>An implementation of com.mysql.jdbc.ConnectionPropertiesTransform that
                     the driver will use to modify URL properties passed

@@ -1144,16 +1136,16 @@
         <para>
           <informaltable>
             <tgroup cols="4">
-              <colspec colwidth="30*" colname="cj_propstbl_prop_name"/>
-              <colspec colwidth="50*" colname="cj_propstbl_prop_defn"/>
-              <colspec colwidth="10*" colname="cj_propstbl_default"/>
-              <colspec colwidth="10*" colname="cj_propstbl_since_version"/>
+              <colspec colwidth="30*" colname="cj_propstbl_prop_name" />
+              <colspec colwidth="50*" colname="cj_propstbl_prop_defn" />
+              <colspec colwidth="10*" colname="cj_propstbl_default" />
+              <colspec colwidth="10*" colname="cj_propstbl_since_version" />
               <tbody>
                 <row>
-                  <entry><emphasis role="bold"> Property Name </emphasis></entry>
-                  <entry><emphasis role="bold"> Definition </emphasis></entry>
-                  <entry><emphasis role="bold"> Default Value </emphasis></entry>
-                  <entry><emphasis role="bold"> Since Version </emphasis></entry>
+                  <entry><emphasis role="bold">Property Name</emphasis></entry>
+                  <entry><emphasis role="bold">Definition</emphasis></entry>
+                  <entry><emphasis role="bold">Default Value</emphasis></entry>
+                  <entry><emphasis role="bold">Since Version</emphasis></entry>
                 </row>
                 <row>
                   <entry>autoReconnect</entry>

@@ -1165,11 +1157,11 @@
                     connection in a new transaction. The use of this
                     feature is not recommended, because it has side
                     effects related to session state and data
-                    consistency when applications don'thandle
+                    consistency when applications don't handle
                     SQLExceptions properly, and is only designed to be
                     used when you are unable to configure your
                     application to handle SQLExceptions resulting from
-                    dead andstale connections properly. Alternatively,
+                    dead and stale connections properly. Alternatively,
                     investigate setting the MySQL server variable
                     "wait_timeout"to some high value rather than the
                     default of 8 hours.</entry>

@@ -1227,6 +1219,15 @@
                   <entry>3.0.2</entry>
                 </row>
                 <row>
+                  <entry>enableDeprecatedAutoreconnect</entry>
+                  <entry>Auto-reconnect functionality is deprecated starting with version 3.2,
+                    and will be removed in version 3.3. Set this
+                    property to 'true' to disable the check for the
+                    feature being configured.</entry>
+                  <entry>false</entry>
+                  <entry>3.2.1</entry>
+                </row>
+                <row>
                   <entry>resourceId</entry>
                   <entry>A globally unique name that identifies the resource that this datasource
                     or connection is connected to, used for

@@ -1250,16 +1251,16 @@
         <para>
           <informaltable>
             <tgroup cols="4">
-              <colspec colwidth="30*" colname="cj_propstbl_prop_name"/>
-              <colspec colwidth="50*" colname="cj_propstbl_prop_defn"/>
-              <colspec colwidth="10*" colname="cj_propstbl_default"/>
-              <colspec colwidth="10*" colname="cj_propstbl_since_version"/>
+              <colspec colwidth="30*" colname="cj_propstbl_prop_name" />
+              <colspec colwidth="50*" colname="cj_propstbl_prop_defn" />
+              <colspec colwidth="10*" colname="cj_propstbl_default" />
+              <colspec colwidth="10*" colname="cj_propstbl_since_version" />
               <tbody>
                 <row>
-                  <entry><emphasis role="bold"> Property Name </emphasis></entry>
-                  <entry><emphasis role="bold"> Definition </emphasis></entry>
-                  <entry><emphasis role="bold"> Default Value </emphasis></entry>
-                  <entry><emphasis role="bold"> Since Version </emphasis></entry>
+                  <entry><emphasis role="bold">Property Name</emphasis></entry>
+                  <entry><emphasis role="bold">Definition</emphasis></entry>
+                  <entry><emphasis role="bold">Default Value</emphasis></entry>
+                  <entry><emphasis role="bold">Since Version</emphasis></entry>
                 </row>
                 <row>
                   <entry>allowMultiQueries</entry>

@@ -1309,16 +1310,16 @@
         <para>
           <informaltable>
             <tgroup cols="4">
-              <colspec colwidth="30*" colname="cj_propstbl_prop_name"/>
-              <colspec colwidth="50*" colname="cj_propstbl_prop_defn"/>
-              <colspec colwidth="10*" colname="cj_propstbl_default"/>
-              <colspec colwidth="10*" colname="cj_propstbl_since_version"/>
+              <colspec colwidth="30*" colname="cj_propstbl_prop_name" />
+              <colspec colwidth="50*" colname="cj_propstbl_prop_defn" />
+              <colspec colwidth="10*" colname="cj_propstbl_default" />
+              <colspec colwidth="10*" colname="cj_propstbl_since_version" />
               <tbody>
                 <row>
-                  <entry><emphasis role="bold"> Property Name </emphasis></entry>
-                  <entry><emphasis role="bold"> Definition </emphasis></entry>
-                  <entry><emphasis role="bold"> Default Value </emphasis></entry>
-                  <entry><emphasis role="bold"> Since Version </emphasis></entry>
+                  <entry><emphasis role="bold">Property Name</emphasis></entry>
+                  <entry><emphasis role="bold">Definition</emphasis></entry>
+                  <entry><emphasis role="bold">Default Value</emphasis></entry>
+                  <entry><emphasis role="bold">Since Version</emphasis></entry>
                 </row>
                 <row>
                   <entry>metadataCacheSize</entry>

@@ -1458,13 +1459,6 @@
                   <entry>3.1.13</entry>
                 </row>
                 <row>
-                  <entry>useFastDateParsing</entry>
-                  <entry>Use internal String-&gt;Date/Time/Teimstamp conversion routines to avoid
-                    excessive object creation?</entry>
-                  <entry>true</entry>
-                  <entry>5.0.5</entry>
-                </row>
-                <row>
                   <entry>useFastIntParsing</entry>
                   <entry>Use internal String-&gt;Integer conversion routines to avoid excessive
                     object creation?</entry>

@@ -1475,8 +1469,9 @@
                   <entry>useJvmCharsetConverters</entry>
                   <entry>Always use the character encoding routines built into the JVM, rather
                     than using lookup tables for single-byte character
-                    sets?</entry>
-                  <entry>false</entry>
+                    sets? (The default of "true" for this is appropriate
+                    for newer JVMs</entry>
+                  <entry>true</entry>
                   <entry>5.0.1</entry>
                 </row>
                 <row>

@@ -1510,16 +1505,16 @@
         <para>
           <informaltable>
             <tgroup cols="4">
-              <colspec colwidth="30*" colname="cj_propstbl_prop_name"/>
-              <colspec colwidth="50*" colname="cj_propstbl_prop_defn"/>
-              <colspec colwidth="10*" colname="cj_propstbl_default"/>
-              <colspec colwidth="10*" colname="cj_propstbl_since_version"/>
+              <colspec colwidth="30*" colname="cj_propstbl_prop_name" />
+              <colspec colwidth="50*" colname="cj_propstbl_prop_defn" />
+              <colspec colwidth="10*" colname="cj_propstbl_default" />
+              <colspec colwidth="10*" colname="cj_propstbl_since_version" />
               <tbody>
                 <row>
-                  <entry><emphasis role="bold"> Property Name </emphasis></entry>
-                  <entry><emphasis role="bold"> Definition </emphasis></entry>
-                  <entry><emphasis role="bold"> Default Value </emphasis></entry>
-                  <entry><emphasis role="bold"> Since Version </emphasis></entry>
+                  <entry><emphasis role="bold">Property Name</emphasis></entry>
+                  <entry><emphasis role="bold">Definition</emphasis></entry>
+                  <entry><emphasis role="bold">Default Value</emphasis></entry>
+                  <entry><emphasis role="bold">Since Version</emphasis></entry>
                 </row>
                 <row>
                   <entry>logger</entry>

@@ -1617,21 +1612,6 @@
                   <entry>3.1.2</entry>
                 </row>
                 <row>
-                  <entry>logXaCommands</entry>
-                  <entry>Should the driver log XA commands sent by MysqlXaConnection to the
-                    server, at the DEBUG level of logging?</entry>
-                  <entry>false</entry>
-                  <entry>5.0.5</entry>
-                </row>
-                <row>
-                  <entry>resultSetSizeThreshold</entry>
-                  <entry>If the usage advisor is enabled, how many rows should a result set
-                    contain before the driver warns that it is
-                    suspiciously large?</entry>
-                  <entry>100</entry>
-                  <entry>5.0.5</entry>
-                </row>
-                <row>
                   <entry>traceProtocol</entry>
                   <entry>Should trace-level network protocol be logged?</entry>
                   <entry>false</entry>

@@ -1651,16 +1631,16 @@
         <para>
           <informaltable>
             <tgroup cols="4">
-              <colspec colwidth="30*" colname="cj_propstbl_prop_name"/>
-              <colspec colwidth="50*" colname="cj_propstbl_prop_defn"/>
-              <colspec colwidth="10*" colname="cj_propstbl_default"/>
-              <colspec colwidth="10*" colname="cj_propstbl_since_version"/>
+              <colspec colwidth="30*" colname="cj_propstbl_prop_name" />
+              <colspec colwidth="50*" colname="cj_propstbl_prop_defn" />
+              <colspec colwidth="10*" colname="cj_propstbl_default" />
+              <colspec colwidth="10*" colname="cj_propstbl_since_version" />
               <tbody>
                 <row>
-                  <entry><emphasis role="bold"> Property Name </emphasis></entry>
-                  <entry><emphasis role="bold"> Definition </emphasis></entry>
-                  <entry><emphasis role="bold"> Default Value </emphasis></entry>
-                  <entry><emphasis role="bold"> Since Version </emphasis></entry>
+                  <entry><emphasis role="bold">Property Name</emphasis></entry>
+                  <entry><emphasis role="bold">Definition</emphasis></entry>
+                  <entry><emphasis role="bold">Default Value</emphasis></entry>
+                  <entry><emphasis role="bold">Since Version</emphasis></entry>
                 </row>
                 <row>
                   <entry>useUnicode</entry>

@@ -1784,16 +1764,6 @@
                   <entry>3.1.7</entry>
                 </row>
                 <row>
-                  <entry>generateSimpleParameterMetadata</entry>
-                  <entry>Should the driver generate simplified parameter metadata for
-                    PreparedStatements when no metadata is available
-                    either because the server couldn't support preparing
-                    the statement, or server-side prepared statements
-                    are disabled?</entry>
-                  <entry>false</entry>
-                  <entry>5.0.5</entry>
-                </row>
-                <row>
                   <entry>ignoreNonTxTables</entry>
                   <entry>Ignore non-transactional table warning for rollback? (defaults to
                     'false').</entry>

@@ -1962,13 +1932,6 @@
                   <entry>3.1.9</entry>
                 </row>
                 <row>
-                  <entry>treatUtilDateAsTimestamp</entry>
-                  <entry>Should the driver treat java.util.Date as a TIMESTAMP for the purposes
-                    of PreparedStatement.setObject()?</entry>
-                  <entry>true</entry>
-                  <entry>5.0.5</entry>
-                </row>
-                <row>
                   <entry>ultraDevHack</entry>
                   <entry>Create PreparedStatements for prepareCall() when required, because
                     UltraDev is broken and issues a prepareCall() for

@@ -2036,20 +1999,10 @@
                   <entry>3.0.15</entry>
                 </row>
                 <row>
-                  <entry>useSSPSCompatibleTimezoneShift</entry>
-                  <entry>If migrating from an environment that was using server-side prepared
-                    statements, and the configuration property
-                    "useJDBCCompliantTimeZoneShift" set to "true", use
-                    compatible behavior when not using server-side
-                    prepared statements when sending TIMESTAMP values to
-                    the MySQL server.</entry>
-                  <entry>false</entry>
-                  <entry>5.0.5</entry>
-                </row>
-                <row>
                   <entry>useServerPrepStmts</entry>
-                  <entry>Use server-side prepared statements if the server supports them?</entry>
-                  <entry>false</entry>
+                  <entry>Use server-side prepared statements if the server supports them?
+                    (defaults to 'true').</entry>
+                  <entry>true</entry>
                   <entry>3.1.0</entry>
                 </row>
                 <row>

@@ -2181,7 +2134,7 @@
 <programlisting>SELECT id, data as 'data' from blobtable</programlisting>
 
           <para>
-            For this to work, you must also follow these rules:
+            For this to work, you must also follow follow these rules:
           </para>
 
           <itemizedlist>

@@ -3290,841 +3243,6 @@
 
     </section>
 
-    <section id="connector-j-reference-error-sqlstates">
-
-      <title>Mapping MySQL Error Numbers to SQLStates</title>
-
-      <para>
-        The table below provides a mapping of the MySQL Error Numbers to
-        <literal>SQLStates</literal>.
-      </para>
-
-<!--
-Auto generated content from C/J and build (target docs-generate-error-mapping-table)
--->
-
-      <table>
-        <title>Mapping of MySQL Error Numbers to SQLStates</title>
-        <tgroup cols="4">
-          <colspec colwidth="15*"/>
-          <colspec colwidth="55*"/>
-          <colspec colwidth="15*"/>
-          <colspec colwidth="15*"/>
-          <thead>
-            <row>
-              <entry>MySQL Error Number</entry>
-              <entry>MySQL Error Name</entry>
-              <entry>Legacy (X/Open) SQLState</entry>
-              <entry>SQL Standard SQLState</entry>
-            </row>
-          </thead>
-          <tbody>
-            <row>
-              <entry>1022</entry>
-              <entry>ER_DUP_KEY</entry>
-              <entry>S1000</entry>
-              <entry>23000</entry>
-            </row>
-            <row>
-              <entry>1037</entry>
-              <entry>ER_OUTOFMEMORY</entry>
-              <entry>S1001</entry>
-              <entry>HY001</entry>
-            </row>
-            <row>
-              <entry>1038</entry>
-              <entry>ER_OUT_OF_SORTMEMORY</entry>
-              <entry>S1001</entry>
-              <entry>HY001</entry>
-            </row>
-            <row>
-              <entry>1040</entry>
-              <entry>ER_CON_COUNT_ERROR</entry>
-              <entry>08004</entry>
-              <entry>08004</entry>
-            </row>
-            <row>
-              <entry>1042</entry>
-              <entry>ER_BAD_HOST_ERROR</entry>
-              <entry>08004</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1043</entry>
-              <entry>ER_HANDSHAKE_ERROR</entry>
-              <entry>08004</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1044</entry>
-              <entry>ER_DBACCESS_DENIED_ERROR</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1045</entry>
-              <entry>ER_ACCESS_DENIED_ERROR</entry>
-              <entry>28000</entry>
-              <entry>28000</entry>
-            </row>
-            <row>
-              <entry>1047</entry>
-              <entry>ER_UNKNOWN_COM_ERROR</entry>
-              <entry>08S01</entry>
-              <entry>HY000</entry>
-            </row>
-            <row>
-              <entry>1050</entry>
-              <entry>ER_TABLE_EXISTS_ERROR</entry>
-              <entry>S1000</entry>
-              <entry>42S01</entry>
-            </row>
-            <row>
-              <entry>1051</entry>
-              <entry>ER_BAD_TABLE_ERROR</entry>
-              <entry>42S02</entry>
-              <entry>42S02</entry>
-            </row>
-            <row>
-              <entry>1052</entry>
-              <entry>ER_NON_UNIQ_ERROR</entry>
-              <entry>S1000</entry>
-              <entry>23000</entry>
-            </row>
-            <row>
-              <entry>1053</entry>
-              <entry>ER_SERVER_SHUTDOWN</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1054</entry>
-              <entry>ER_BAD_FIELD_ERROR</entry>
-              <entry>S0022</entry>
-              <entry>42S22</entry>
-            </row>
-            <row>
-              <entry>1055</entry>
-              <entry>ER_WRONG_FIELD_WITH_GROUP</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1056</entry>
-              <entry>ER_WRONG_GROUP_FIELD</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1057</entry>
-              <entry>ER_WRONG_SUM_SELECT</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1058</entry>
-              <entry>ER_WRONG_VALUE_COUNT</entry>
-              <entry>21S01</entry>
-              <entry>21S01</entry>
-            </row>
-            <row>
-              <entry>1059</entry>
-              <entry>ER_TOO_LONG_IDENT</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1060</entry>
-              <entry>ER_DUP_FIELDNAME</entry>
-              <entry>S1009</entry>
-              <entry>42S21</entry>
-            </row>
-            <row>
-              <entry>1061</entry>
-              <entry>ER_DUP_KEYNAME</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1062</entry>
-              <entry>ER_DUP_ENTRY</entry>
-              <entry>S1009</entry>
-              <entry>23000</entry>
-            </row>
-            <row>
-              <entry>1063</entry>
-              <entry>ER_WRONG_FIELD_SPEC</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1064</entry>
-              <entry>ER_PARSE_ERROR</entry>
-              <entry>42000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1065</entry>
-              <entry>ER_EMPTY_QUERY</entry>
-              <entry>42000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1066</entry>
-              <entry>ER_NONUNIQ_TABLE</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1067</entry>
-              <entry>ER_INVALID_DEFAULT</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1068</entry>
-              <entry>ER_MULTIPLE_PRI_KEY</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1069</entry>
-              <entry>ER_TOO_MANY_KEYS</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1070</entry>
-              <entry>ER_TOO_MANY_KEY_PARTS</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1071</entry>
-              <entry>ER_TOO_LONG_KEY</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1072</entry>
-              <entry>ER_KEY_COLUMN_DOES_NOT_EXITS</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1073</entry>
-              <entry>ER_BLOB_USED_AS_KEY</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1074</entry>
-              <entry>ER_TOO_BIG_FIELDLENGTH</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1075</entry>
-              <entry>ER_WRONG_AUTO_KEY</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1080</entry>
-              <entry>ER_FORCING_CLOSE</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1081</entry>
-              <entry>ER_IPSOCK_ERROR</entry>
-              <entry>08S01</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1082</entry>
-              <entry>ER_NO_SUCH_INDEX</entry>
-              <entry>S1009</entry>
-              <entry>42S12</entry>
-            </row>
-            <row>
-              <entry>1083</entry>
-              <entry>ER_WRONG_FIELD_TERMINATORS</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1084</entry>
-              <entry>ER_BLOBS_AND_NO_TERMINATED</entry>
-              <entry>S1009</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1090</entry>
-              <entry>ER_CANT_REMOVE_ALL_FIELDS</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1091</entry>
-              <entry>ER_CANT_DROP_FIELD_OR_KEY</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1101</entry>
-              <entry>ER_BLOB_CANT_HAVE_DEFAULT</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1102</entry>
-              <entry>ER_WRONG_DB_NAME</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1103</entry>
-              <entry>ER_WRONG_TABLE_NAME</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1104</entry>
-              <entry>ER_TOO_BIG_SELECT</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1106</entry>
-              <entry>ER_UNKNOWN_PROCEDURE</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1107</entry>
-              <entry>ER_WRONG_PARAMCOUNT_TO_PROCEDURE</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1109</entry>
-              <entry>ER_UNKNOWN_TABLE</entry>
-              <entry>S1000</entry>
-              <entry>42S02</entry>
-            </row>
-            <row>
-              <entry>1110</entry>
-              <entry>ER_FIELD_SPECIFIED_TWICE</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1112</entry>
-              <entry>ER_UNSUPPORTED_EXTENSION</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1113</entry>
-              <entry>ER_TABLE_MUST_HAVE_COLUMNS</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1115</entry>
-              <entry>ER_UNKNOWN_CHARACTER_SET</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1118</entry>
-              <entry>ER_TOO_BIG_ROWSIZE</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1120</entry>
-              <entry>ER_WRONG_OUTER_JOIN</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1121</entry>
-              <entry>ER_NULL_COLUMN_IN_INDEX</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1129</entry>
-              <entry>ER_HOST_IS_BLOCKED</entry>
-              <entry>08004</entry>
-              <entry>HY000</entry>
-            </row>
-            <row>
-              <entry>1130</entry>
-              <entry>ER_HOST_NOT_PRIVILEGED</entry>
-              <entry>08004</entry>
-              <entry>HY000</entry>
-            </row>
-            <row>
-              <entry>1131</entry>
-              <entry>ER_PASSWORD_ANONYMOUS_USER</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1132</entry>
-              <entry>ER_PASSWORD_NOT_ALLOWED</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1133</entry>
-              <entry>ER_PASSWORD_NO_MATCH</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1136</entry>
-              <entry>ER_WRONG_VALUE_COUNT_ON_ROW</entry>
-              <entry>S1000</entry>
-              <entry>21S01</entry>
-            </row>
-            <row>
-              <entry>1138</entry>
-              <entry>ER_INVALID_USE_OF_NULL</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1139</entry>
-              <entry>ER_REGEXP_ERROR</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1140</entry>
-              <entry>ER_MIX_OF_GROUP_FUNC_AND_FIELDS</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1141</entry>
-              <entry>ER_NONEXISTING_GRANT</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1142</entry>
-              <entry>ER_TABLEACCESS_DENIED_ERROR</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1143</entry>
-              <entry>ER_COLUMNACCESS_DENIED_ERROR</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1144</entry>
-              <entry>ER_ILLEGAL_GRANT_FOR_TABLE</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1145</entry>
-              <entry>ER_GRANT_WRONG_HOST_OR_USER</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1146</entry>
-              <entry>ER_NO_SUCH_TABLE</entry>
-              <entry>S1000</entry>
-              <entry>42S02</entry>
-            </row>
-            <row>
-              <entry>1147</entry>
-              <entry>ER_NONEXISTING_TABLE_GRANT</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1148</entry>
-              <entry>ER_NOT_ALLOWED_COMMAND</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1149</entry>
-              <entry>ER_SYNTAX_ERROR</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1152</entry>
-              <entry>ER_ABORTING_CONNECTION</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1153</entry>
-              <entry>ER_NET_PACKET_TOO_LARGE</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1154</entry>
-              <entry>ER_NET_READ_ERROR_FROM_PIPE</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1155</entry>
-              <entry>ER_NET_FCNTL_ERROR</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1156</entry>
-              <entry>ER_NET_PACKETS_OUT_OF_ORDER</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1157</entry>
-              <entry>ER_NET_UNCOMPRESS_ERROR</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1158</entry>
-              <entry>ER_NET_READ_ERROR</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1159</entry>
-              <entry>ER_NET_READ_INTERRUPTED</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1160</entry>
-              <entry>ER_NET_ERROR_ON_WRITE</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1161</entry>
-              <entry>ER_NET_WRITE_INTERRUPTED</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1162</entry>
-              <entry>ER_TOO_LONG_STRING</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1163</entry>
-              <entry>ER_TABLE_CANT_HANDLE_BLOB</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1164</entry>
-              <entry>ER_TABLE_CANT_HANDLE_AUTO_INCREMENT</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1166</entry>
-              <entry>ER_WRONG_COLUMN_NAME</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1167</entry>
-              <entry>ER_WRONG_KEY_COLUMN</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1169</entry>
-              <entry>ER_DUP_UNIQUE</entry>
-              <entry>S1000</entry>
-              <entry>23000</entry>
-            </row>
-            <row>
-              <entry>1170</entry>
-              <entry>ER_BLOB_KEY_WITHOUT_LENGTH</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1171</entry>
-              <entry>ER_PRIMARY_CANT_HAVE_NULL</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1172</entry>
-              <entry>ER_TOO_MANY_ROWS</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1173</entry>
-              <entry>ER_REQUIRES_PRIMARY_KEY</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1177</entry>
-              <entry>ER_CHECK_NO_SUCH_TABLE</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1178</entry>
-              <entry>ER_CHECK_NOT_IMPLEMENTED</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1179</entry>
-              <entry>ER_CANT_DO_THIS_DURING_AN_TRANSACTION</entry>
-              <entry>S1000</entry>
-              <entry>25000</entry>
-            </row>
-            <row>
-              <entry>1184</entry>
-              <entry>ER_NEW_ABORTING_CONNECTION</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1189</entry>
-              <entry>ER_MASTER_NET_READ</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1190</entry>
-              <entry>ER_MASTER_NET_WRITE</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1203</entry>
-              <entry>ER_TOO_MANY_USER_CONNECTIONS</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1205</entry>
-              <entry>ER_LOCK_WAIT_TIMEOUT</entry>
-              <entry>41000</entry>
-              <entry>41000</entry>
-            </row>
-            <row>
-              <entry>1207</entry>
-              <entry>ER_READ_ONLY_TRANSACTION</entry>
-              <entry>S1000</entry>
-              <entry>25000</entry>
-            </row>
-            <row>
-              <entry>1211</entry>
-              <entry>ER_NO_PERMISSION_TO_CREATE_USER</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1213</entry>
-              <entry>ER_LOCK_DEADLOCK</entry>
-              <entry>41000</entry>
-              <entry>40001</entry>
-            </row>
-            <row>
-              <entry>1216</entry>
-              <entry>ER_NO_REFERENCED_ROW</entry>
-              <entry>S1000</entry>
-              <entry>23000</entry>
-            </row>
-            <row>
-              <entry>1217</entry>
-              <entry>ER_ROW_IS_REFERENCED</entry>
-              <entry>S1000</entry>
-              <entry>23000</entry>
-            </row>
-            <row>
-              <entry>1218</entry>
-              <entry>ER_CONNECT_TO_MASTER</entry>
-              <entry>S1000</entry>
-              <entry>08S01</entry>
-            </row>
-            <row>
-              <entry>1222</entry>
-              <entry>ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT</entry>
-              <entry>S1000</entry>
-              <entry>21000</entry>
-            </row>
-            <row>
-              <entry>1226</entry>
-              <entry>ER_USER_LIMIT_REACHED</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1230</entry>
-              <entry>ER_NO_DEFAULT</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1231</entry>
-              <entry>ER_WRONG_VALUE_FOR_VAR</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1232</entry>
-              <entry>ER_WRONG_TYPE_FOR_VAR</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1234</entry>
-              <entry>ER_CANT_USE_OPTION_HERE</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1235</entry>
-              <entry>ER_NOT_SUPPORTED_YET</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1239</entry>
-              <entry>ER_WRONG_FK_DEF</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1241</entry>
-              <entry>ER_OPERAND_COLUMNS</entry>
-              <entry>S1000</entry>
-              <entry>21000</entry>
-            </row>
-            <row>
-              <entry>1242</entry>
-              <entry>ER_SUBQUERY_NO_1_ROW</entry>
-              <entry>S1000</entry>
-              <entry>21000</entry>
-            </row>
-            <row>
-              <entry>1247</entry>
-              <entry>ER_ILLEGAL_REFERENCE</entry>
-              <entry>S1000</entry>
-              <entry>42S22</entry>
-            </row>
-            <row>
-              <entry>1248</entry>
-              <entry>ER_DERIVED_MUST_HAVE_ALIAS</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1249</entry>
-              <entry>ER_SELECT_REDUCED</entry>
-              <entry>S1000</entry>
-              <entry>01000</entry>
-            </row>
-            <row>
-              <entry>1250</entry>
-              <entry>ER_TABLENAME_NOT_ALLOWED_HERE</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1251</entry>
-              <entry>ER_NOT_SUPPORTED_AUTH_MODE</entry>
-              <entry>S1000</entry>
-              <entry>08004</entry>
-            </row>
-            <row>
-              <entry>1252</entry>
-              <entry>ER_SPATIAL_CANT_HAVE_NULL</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1253</entry>
-              <entry>ER_COLLATION_CHARSET_MISMATCH</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1261</entry>
-              <entry>ER_WARN_TOO_FEW_RECORDS</entry>
-              <entry>S1000</entry>
-              <entry>01000</entry>
-            </row>
-            <row>
-              <entry>1262</entry>
-              <entry>ER_WARN_TOO_MANY_RECORDS</entry>
-              <entry>S1000</entry>
-              <entry>01000</entry>
-            </row>
-            <row>
-              <entry>1263</entry>
-              <entry>ER_WARN_NULL_TO_NOTNULL</entry>
-              <entry>S1000</entry>
-              <entry>01000</entry>
-            </row>
-            <row>
-              <entry>1264</entry>
-              <entry>ER_WARN_DATA_OUT_OF_RANGE</entry>
-              <entry>S1000</entry>
-              <entry>01000</entry>
-            </row>
-            <row>
-              <entry>1265</entry>
-              <entry>ER_WARN_DATA_TRUNCATED</entry>
-              <entry>S1000</entry>
-              <entry>01000</entry>
-            </row>
-            <row>
-              <entry>1280</entry>
-              <entry>ER_WRONG_NAME_FOR_INDEX</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1281</entry>
-              <entry>ER_WRONG_NAME_FOR_CATALOG</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-            <row>
-              <entry>1286</entry>
-              <entry>ER_UNKNOWN_STORAGE_ENGINE</entry>
-              <entry>S1000</entry>
-              <entry>42000</entry>
-            </row>
-          </tbody>
-        </tgroup>
-      </table>
-
-<!-- End auto-generated content -->
-
-    </section>
-
   </section>
 
   <section id="connector-j-usagenotes">

@@ -5485,8 +4603,12 @@
              our implementation of these to increase the robustness
              of the connection pool. --&gt;
 
-        &lt;exception-sorter-class-name&gt;com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter&lt;/exception-sorter-class-name&gt;
-        &lt;valid-connection-checker-class-name&gt;com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker&lt;/valid-connection-checker-class-name&gt;
+        &lt;exception-sorter-class-name&gt; 
+  com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter
+        &lt;/exception-sorter-class-name&gt;
+        &lt;valid-connection-checker-class-name&gt;
+  com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker
+        &lt;/valid-connection-checker-class-name&gt;
 
     &lt;/local-tx-datasource&gt;
 &lt;/datasources&gt; </programlisting>

@@ -5508,13 +4630,450 @@
       </section>
 -->
 
-<!--
       <section id="connector-j-usagenotes-spring-config">
+
         <title>Using Connector/J with Spring</title>
 
-        <para />
+        <para>
+          The Spring Framework is a Java-based application framework
+          designed for assisting in application design by providing a
+          way to configure components. The technique used by Spring is a
+          well known design pattern called Dependency Injection (see
+          <ulink
+            url="http://www.martinfowler.com/articles/injection.html">Inversion
+          of Control Containers and the Dependency Injection
+          pattern</ulink>). This article will focus on Java-oriented
+          access to MySQL databases with Spring 2.0. For those
+          wondering, there is a .NET port of Spring appropriately named
+          Spring.NET.
+        </para>
+
+        <para>
+          Spring is not only a system for configuring components, but
+          also includes support for aspect oriented programming (AOP).
+          This is one of the main benefits and the foundation for
+          Spring's resource and transaction management. Spring also
+          provides utilities for integrating resource management with
+          JDBC and Hibernate.
+        </para>
+
+        <para>
+          For the examples in this section the MySQL world sample
+          database will be used. The first task is to setup a MySQL data
+          source through Spring. Components within Spring use the "bean"
+          terminology. For example, to configure a connection to a MySQL
+          server supporting the world sample database you might use:
+        </para>
+
+<programlisting><![CDATA[<util:map id="dbProps">
+    <entry key="db.driver" value="com.mysql.jdbc.Driver"/>
+    <entry key="db.jdbcurl" value="jdbc:mysql://localhost/world"/>
+    <entry key="db.username" value="myuser"/>
+    <entry key="db.password" value="mypass"/>
+</util:map>
+]]>
+        </programlisting>
+
+        <para>
+          In the above example we are assigning values to properties
+          that will be used in the configuration. For the datasource
+          configuration:
+        </para>
+
+<programlisting><![CDATA[<bean id="dataSource" 
+       class="org.springframework.jdbc.datasource.DriverManagerDataSource">
+    <property name="driverClassName" value="${db.driver}"/>
+    <property name="url" value="${db.jdbcurl}"/>
+    <property name="username" value="${db.username}"/>
+    <property name="password" value="${db.password}"/>
+</bean>
+        ]]></programlisting>
+
+        <para>
+          The placeholders are used to provide values for properties of
+          this bean. This means that you can specify all the properties
+          of the configuration in one place instead of entering the
+          values for each property on each bean. We do, however, need
+          one more bean to pull this all together. The last bean is
+          responsible for actually replacing the placeholders with the
+          property values.
+        </para>
+
+<programlisting><![CDATA[<bean 
+ class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+    <property name="properties" ref="dbProps"/>
+</bean>
+        ]]></programlisting>
+
+        <para>
+          Now that we have our MySQL data source configured and ready to
+          go, we write some Java code to access it. The example below
+          will retrieve three random cities and their corresponding
+          country using the data source we configured with Spring.
+        </para>
+
+<programlisting>
+// Create a new application context. this processes the Spring config
+ApplicationContext ctx =
+    new ClassPathXmlApplicationContext("ex1appContext.xml");
+// Retrieve the data source from the application context
+    DataSource ds = (DataSource) ctx.getBean("dataSource");
+// Open a database connection using Spring's DataSourceUtils
+Connection c = DataSourceUtils.getConnection(ds);
+try {
+    // retrieve a list of three random cities
+    PreparedStatement ps = c.prepareStatement(
+        "select City.Name as 'City', Country.Name as 'Country' " +
+        "from City inner join Country on City.CountryCode = Country.Code " +
+        "order by rand() limit 3");
+    ResultSet rs = ps.executeQuery();
+    while(rs.next()) {
+        String city = rs.getString("City");
+        String country = rs.getString("Country");
+        System.out.printf("The city %s is in %s%n", city, country);
+    }
+} catch (SQLException ex) {
+    // something has failed and we print a stack trace to analyse the error
+    ex.printStackTrace();
+    // ignore failure closing connection
+    try { c.close(); } catch (SQLException e) { }
+} finally {
+    // properly release our connection
+    DataSourceUtils.releaseConnection(c, ds);
+}</programlisting>
+
+        <para>
+          This is very similar to normal JDBC access to MySQL with the
+          main difference being that we are using DataSourceUtils
+          instead of the DriverManager to create the connection.
+        </para>
+
+        <para>
+          While it may seem like a small difference, the implications
+          are somewhat far reaching. Spring manages this resource in a
+          way similar to a container managed data source in a J2EE
+          application server. When a connection is opened, it can be
+          subsequently accessed in other parts of the code if it is
+          synchronized with a transaction. This makes it possible to
+          treat different parts of your application as transactional
+          instead of passing around a database connection.
+        </para>
+
+        <section id="connector-j-usagenotes-spring-config-jdbctemplate">
+
+          <title>Using <classname>JdbcTemplate</classname></title>
+
+          <para>
+            Spring makes extensive use of the Template method design
+            pattern (see
+            <ulink
+              url="http://en.wikipedia.org/wiki/Template_method_pattern">Template
+            Method Pattern</ulink>). Our immediate focus will be on the
+            <literal>JdbcTemplate</literal> and related classes,
+            specifically <literal>NamedParameterJdbcTemplate</literal>.
+            The template classes handle obtaining and releasing a
+            connection for data access when one is needed.
+          </para>
+
+          <para>
+            The next example shows how to use
+            <literal>NamedParameterJdbcTemplate</literal> inside of a
+            DAO (Data Access Object) class to retrieve a random city
+            given a country code.
+          </para>
+
+<programlisting>public class Ex2JdbcDao {
+     /**
+     * Data source reference which will be provided by Spring.
+     */
+     private DataSource dataSource;
+        
+     /**
+     * Our query to find a random city given a country code. Notice
+     * the ":country" parameter towards the end. This is called a
+     * named parameter.
+     */
+     private String queryString = "select Name from City " +
+        "where CountryCode = :country order by rand() limit 1";
+        
+     /**
+     * Retrieve a random city using Spring JDBC access classes.
+     */
+     public String getRandomCityByCountryCode(String cntryCode) {
+         // A template that allows using queries with named parameters
+         NamedParameterJdbcTemplate template =
+         new NamedParameterJdbcTemplate(dataSource);
+         // A java.util.Map is used to provide values for the parameters
+         Map params = new HashMap();
+         params.put("country", cntryCode);
+         // We query for an Object and specify what class we are expecting
+         return (String)template.queryForObject(queryString, params, String.class);
+     }
+        
+    /**
+    * A JavaBean setter-style method to allow Spring to inject the data source.
+    * @param dataSource
+    */
+    public void setDataSource(DataSource dataSource) {
+        this.dataSource = dataSource;
+    }
+}
+   </programlisting>
+
+          <para>
+            The focus in the above code is on the
+            <literal>getRandomCityByCountryCode()</literal> method. We
+            pass a country code and use the
+            <literal>NamedParameterJdbcTemplate</literal> to query for a
+            city. The country code is placed in a Map with the key
+            "country", which is the parameter is named in the SQL query.
+          </para>
+
+          <para>
+            To access this code, you need to configure it with Spring by
+            providing a reference to the data source.
+          </para>
+
+<programlisting><![CDATA[<bean id="dao" class="code.Ex2JdbcDao">
+    <property name="dataSource" ref="dataSource"/>
+</bean>]]></programlisting>
+
+          <para>
+            At this point, we can just grab a reference to the DAO from
+            Spring and call
+            <literal>getRandomCityByCountryCode()</literal>.
+          </para>
+
+<programlisting>// Create the application context
+    ApplicationContext ctx =
+    new ClassPathXmlApplicationContext("ex2appContext.xml");
+    // Obtain a reference to our DAO
+    Ex2JdbcDao dao = (Ex2JdbcDao) ctx.getBean("dao");
+        
+    String countryCode = "USA";
+        
+    // Find a few random cities in the US
+    for(int i = 0; i &lt; 4; ++i)
+        System.out.printf("A random city in %s is %s%n", countryCode,
+            dao.getRandomCityByCountryCode(countryCode));
+</programlisting>
+
+          <para>
+            This example shows how to use Spring's JDBC classes to
+            completely abstract away the use of traditional JDBC classes
+            including <literal>Connection</literal> and
+            <literal>PreparedStatement</literal>.
+          </para>
+
+        </section>
+
+        <section id="connector-j-usagenotes-spring-config-transactional">
+
+          <title>Transactional JDBC Access</title>
+
+          <para>
+            You might be wondering how we can add transactions into our
+            code if we don't deal directly with the JDBC classes. Spring
+            provides a transaction management package that not only
+            replaces JDBC transaction management, but also allows
+            declarative transaction management (configuration instead of
+            code).
+          </para>
+
+          <para>
+            In order to use transactional database access, we will need
+            to change the storage engine of the tables in the world
+            database. The downloaded script explicitly creates MyISAM
+            tables which do not support transactional semantics. The
+            InnoDB storage engine does support transactions and this is
+            what we will be using. We can change the storage engine with
+            the following statements.
+          </para>
+
+<programlisting>ALTER TABLE City ENGINE=InnoDB;
+ALTER TABLE Country ENGINE=InnoDB;
+ALTER TABLE CountryLanguage ENGINE=InnoDB;
+</programlisting>
+
+          <para>
+            A good programming practice emphasized by Spring is
+            separating interfaces and implementations. What this means
+            is that we can create a Java interface and only use the
+            operations on this interface without any internal knowledge
+            of what the actual implementation is. We will let Spring
+            manage the implementation and with this it will manage the
+            transactions for our implementation.
+          </para>
+
+          <para>
+            First you create a simple interface:
+          </para>
+
+<programlisting>public interface Ex3Dao {
+    Integer createCity(String name, String countryCode,
+    String district, Integer population);
+}
+</programlisting>
+
+          <para>
+            This interface contains one method that will create a new
+            city record in the database and return the id of the new
+            record. Next you need to create an implementation of this
+            interface.
+          </para>
+
+<programlisting>public class Ex3DaoImpl implements Ex3Dao {
+    protected DataSource dataSource;
+    protected SqlUpdate updateQuery;
+    protected SqlFunction idQuery;
+        
+    public Integer createCity(String name, String countryCode,
+        String district, Integer population) {
+            updateQuery.update(new Object[] { name, countryCode,
+                   district, population });
+            return getLastId();
+        }
+        
+    protected Integer getLastId() {
+        return idQuery.run();
+    }
+}
+</programlisting>
+
+          <para>
+            You can see that we only operate on abstract query objects
+            here and don't deal directly with the JDBC API. Also, this
+            is the complete implementation. All of our transaction
+            management will be dealt with in the configuration. To get
+            the configuration started, we need to create the DAO.
+          </para>
+
+<programlisting><![CDATA[<bean id="dao" class="code.Ex3DaoImpl">
+    <property name="dataSource" ref="dataSource"/>
+    <property name="updateQuery">...</property>
+    <property name="idQuery">...</property>
+</bean>]]>
+</programlisting>
+
+          <para>
+            Now you need to setup the transaction configuration. The
+            first thing you must do is create transaction manager to
+            manage the data source and a specification of what
+            transaction properties are required for for the
+            <literal>dao</literal> methods.
+          </para>
+
+<programlisting><![CDATA[<bean id="transactionManager" 
+  class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
+    <property name="dataSource" ref="dataSource"/>
+</bean>
+        
+<tx:advice id="txAdvice" transaction-manager="transactionManager">
+    <tx:attributes>
+        <tx:method name="*"/>
+    </tx:attributes>
+</tx:advice>]]></programlisting>
+
+          <para>
+            The preceding code creates a transaction manager that
+            handles transactions for the data source provided to it. The
+            <literal>txAdvice</literal> uses this transaction manager
+            and the attributes specify to create a transaction for all
+            methods. Finally you need to apply this advice with an AOP
+            pointcut.
+          </para>
+
+<programlisting><![CDATA[<aop:config>
+    <aop:pointcut id="daoMethods"
+        expression="execution(* code.Ex3Dao.*(..))"/>
+     <aop:advisor advice-ref="txAdvice" pointcut-ref="daoMethods"/>
+</aop:config>]]></programlisting>
+
+          <para>
+            This basically says that all methods called on the
+            <literal>Ex3Dao</literal> interface will be wrapped in a
+            transaction. To make use of this, you only have to retrieve
+            the <literal>dao</literal> from the application context and
+            call a method on the <literal>dao</literal> instance.
+          </para>
+
+<programlisting>Ex3Dao dao = (Ex3Dao) ctx.getBean("dao");
+Integer id = dao.createCity(name,  countryCode, district, pop);
+</programlisting>
+
+          <para>
+            We can verify from this that there is no transaction
+            management happening in our Java code and it's all
+            configured with Spring. This is a very powerful notion and
+            regarded as one of the most beneficial features of Spring.
+          </para>
+
+        </section>
+
+        <section id="connector-j-usagenotes-spring-config-connpooling">
+
+          <title>Connection Pooling</title>
+
+          <para>
+            In many sitations, such as web applications, there will be a
+            large number of small database transactions. When this is
+            the case, it usually makes sense to create a pool of
+            database connections available for web requests as needed.
+            Although MySQL does not spawn an extra process when a
+            connection is made, there is still a small amount of
+            overhead to create and setup the connection. Pooling of
+            connections also alleviates problems such as collecting
+            large amounts of sockets in the <literal>TIME_WAIT</literal>
+            state.
+          </para>
+
+          <para>
+            Setting up pooling of MySQL connections with Spring is as
+            simple as changing the data source configuration in the
+            application context. There are a number of configurations
+            that we can use. The first example is based on the
+            <ulink url="http://jakarta.apache.org/commons/dbcp/">Jakarta
+            Commons DBCP library</ulink>. The example below replaces the
+            source configuration that was based on
+            <literal>DriverManagerDataSource</literal> with DBCP's
+            BasicDataSource.
+          </para>
+
+<programlisting><![CDATA[<bean id="dataSource" destroy-method="close"
+  class="org.apache.commons.dbcp.BasicDataSource">
+    <property name="driverClassName" value="${db.driver}"/>
+    <property name="url" value="${db.jdbcurl}"/>
+    <property name="username" value="${db.username}"/>
+    <property name="password" value="${db.password}"/>
+    <property name="initialSize" value="3"/>
+</bean>]]></programlisting>
+
+          <para>
+            The configuration of the two solutions is very similar. The
+            difference is that DBCP will pool connections to the
+            database instead of creating a new connection every time one
+            is requested. We have also set a parameter here called
+            <literal>initialSize</literal>. This tells DBCP that we want
+            three connections in the pool when it is created.
+          </para>
+
+          <para>
+            Another way to configure connection pooling is to configure
+            a data source in our J2EE application server. Using JBoss as
+            an example, you can set up the MySQL connection pool by
+            creating a file called
+            <filename>mysql-local-ds.xml</filename> and placing it in
+            the server/default/deploy directory in JBoss. Once we have
+            this setup, we can use JNDI to look it up. With Spring, this
+            lookup is very simple. The data source configuration looks
+            like this.
+          </para>
+
+<programlisting><![CDATA[<jee:jndi-lookup id="dataSource" jndi-name="java:MySQL_DS"/>]]></programlisting>
+
+        </section>
+
       </section>
--->
 
 <!--
       <section id="connector-j-usagenotes-struts-config">


Thread
svn commit - mysqldoc@docsrva: r5514 - trunk/refman-commonmcbrown23 Mar