I have a little jsp site with a mysql DB (both hosted by a provider).
From time to time i get this error when i try to connection to the DB.
Communications link failure
The last packet successfully received from the server was 441,197
milliseconds ago. The last packet sent successfully to the server was 26
milliseconds ago.
I read several posts on the internet talking about similar problem, i but no one seems to suits my issue. Mine is a very simple site, maybe i should set some attributes in the context.xml file. I Created a context.xml similar to the one shown on the book i used to study java and jsp.
Here it is:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/prova" reloadable="true">
<Resource
name="jdbc/myDataSource"
auth="Container"
type="javax.sql.DataSource"
url="..."
username="..."
password="..."
driverClassName="com.mysql.jdbc.Driver"/>
</Context>
the way i "query" the DB is this:
1) i open the connection
2) i make the select
3) i close connection, statement and resultset
I use mysql-connector-java-5.1.17-bin.jar