NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Mysql autoconnect.

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
Oddvard Myrnes
Posted via mailing list.





PostPosted: Tue Feb 23, 2010 5:46 am    Post subject: Mysql autoconnect. Reply with quote

Hi,

I have this enoying problem with MySQL connect timeout message:

oracle.toplink.essentials.exceptions.DatabaseException Internal Exception:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet
successfully received from the server was77782 seconds ago.The last packet
sent successfully to the server was 77782 seconds ago, which is longer than
the server configured value of 'wait_timeout'. You should consider either
expiring and/or testing connection validity before use in your application,
increasing the server configured values for client timeouts, or using the
Connector/J connection property 'autoReconnect=true' to avoid this problem.
Error Code: 0

I have googeled the problem & fount this answer:

http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#
Database%20Connection%20Pool%20%28DBCP%29%20Configurations


I entered into context.xml file:

<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver"
maxActive="20" maxIdle="10" maxWait="120000" name="jdbc/dataSource2"
password="read1234" type="javax.sql.DataSource"
url="jdbc:mysql://localhost:3306/mydb?autoReconnect=true"
username="ReadOnly" removeAbandoned="true" removeAbandonedTimeout="60"
logAbandoned="true"/>


& in the persistence.xml file:

- <properties>
<property name="toplink.config.CacheType" value="WEAK" />
<property name="toplink.config.alwaysRefresh" value="true" />
<property name="toplink.jdbc.autoReconnect" value="true" />
<property name="toplink.jdbc.user" value="ReadOnly" />
<property name="toplink.jdbc.password" value="read1234" />
<property name="toplink.jdbc.url" value="jdbc:mysql://localhost:3306/mydb"
/>
<property name="toplink.jdbc.driver" value="com.mysql.jdbc.Driver" />
</properties>

No joy. Still timeouts. How do I set these parameters in toplink? Any idea
out there?

Oddvard

This email has been verified by Google Postini filtering system
Back to top
jhalupka



Joined: 05 Feb 2010
Posts: 52

PostPosted: Tue Feb 23, 2010 4:16 pm    Post subject: Mysql autoconnect. Reply with quote

Try adding the following entries at the end of MySQL's my.ini file. This file
is located in the MySQL installation's root folder. In my case I installed
MySQL in C:\Applications\MySQL Server 5.0. So my.ini is in that folder.

#The number of seconds the mysqld server is waiting for a connect packet
before responding with 'Bad handshake'
connect_timeout=0
#The number of seconds the server waits for activity on an interactive
connection before closing it.
interactive_timeout=2000000
#The number of seconds the server waits for activity on a connection before
closing it
wait_timeout=2000000

I suspect that MySQL server is timing out and closing idle connections. I
this this is independent of your connection pool settings.


Oddvard Myrnes wrote:
Quote:

oracle.toplink.essentials.exceptions.DatabaseException Internal Exception:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet
successfully received from the server was77782 seconds ago.The last packet
sent successfully to the server was 77782 seconds ago, which is longer
than
the server configured value of 'wait_timeout'. You should consider either
expiring and/or testing connection validity before use in your
application,
increasing the server configured values for client timeouts, or using the
Connector/J connection property 'autoReconnect=true' to avoid this
problem.
Error Code: 0


--
View this message in context: http://old.nabble.com/Mysql-autoconnect.-tp27698760p27705575.html
Sent from the Netbeans IDE Users mailing list archive at Nabble.com.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo