This content has been marked as final.
Show 4 replies
-
1. Re: mysql connection reset
tomerbd2 Oct 18, 2007 10:41 AM (in response to tomerbd2)also note that im using autoReconnect=true
-
2. Re: mysql connection reset
dleerob Dec 6, 2007 1:51 AM (in response to tomerbd2)Did you ever manage to sort this out?
I am currently using Jbpm 3.2.2, MySQL 5.027, mysql-connector-java-5.0.3, and Tomcat 5.028. That exception also occurs daily. Anyone have any ideas on what is causing it? -
3. Re: mysql connection reset
trunikov Dec 15, 2007 2:28 AM (in response to tomerbd2)Hi tomerbd2!
Below is a fragment from J/Connector manual about parameter autoReconnect :Should the driver try to re-establish stale and/or dead connections? If enabled the driver will throw an exception for a queries issued on a stale or dead connection, which belong to the current transaction, but will attempt reconnect before the next query issued on the 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'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 and stale connections properly. Alternatively, investigate setting the MySQL server variable "wait_timeout" to some high value rather than the default of 8 hours.
As stated use parameter autoReconnect is a bad practice. I think you should tune value of a tag idle-timeout-minutes in your data source descriptor. A description/example of how to do that is here.
Also tags check-valid-connection-sql and new-connection-sql could be useful.
Below is an example of a data source descriptor:
<local-tx-datasource>
<jndi-name>xxxDS</jndi-name>
<connection-url>jdbc:mysql://127.0.0.1:3306/xxx</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>xxx</user-name>
yyy
<type-mapping>MySQL</type-mapping>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<idle-timeout-minutes>10</idle-timeout-minutes>
<check-valid-connection-sql>select 1</check-valid-connection-sql>
<new-connection-sql>select 1</new-connection-sql>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
</local-tx-datasource> -
4. Re: mysql connection reset
dleerob Dec 18, 2007 1:14 AM (in response to tomerbd2)I managed to sort out the dropped connection problem. I posted my solution on this thread: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=105658