Customize jdbcexception error message - mysql

I have a java web application which is deployed on a linux server using tomcat and mysql. Most of the time in the morning , When i try to login , it gives the following error : "The last packet successfully received from the server was 60,244,374 milliseconds ago...." This is a common issue and i have already insert some properties in my tomcat connection and i need to wait for testing. Meanwhile , I want to customize this error message to "Server is down". Can someone tell me how to catch this exception?
Note that i use spring security for authentication and for database : hibernate and jpa (jndi)Please find attached error message. This error message is too complex for user!

Related

How to fix " [08S01] Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. "

I'm working on a PHP project using PhpStorm + DataGrip + MySQL + WAMP and since then was working normally with remote database with these configurations (see images):
but suddenly I'm getting this error:
[08S01] Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. java.net.ConnectException: Connection refused: connect
Could someone knows what can I do to solve this error?
I already tried to do what I found here (Solving a "communications link failure" with JDBC and MySQL) and that did not work yet.
I expect to connect again normally to my database.
Hi this error is because you are running a MySQL version 5 or 8.0 and later. And your server is configured to use the protocol of TLS 1.2. So, you need to enable TLS Protocols.
Open Datagrip
Go to Properties
Data Sources > Advanced
In enabledTLSProtocol set the value:
TLSv1,TLSv1.1,TLSv1.2,TLSv1.3
Test connection. And should work!
edit the JDBC url and append this query parameter &enabledTLSProtocols=TLSv1.2

The parent package in SSIS fails with the following

Open Database Connectivity (ODBC) error occurred. state: '08S01'. Native Error Code: 30046. [SAP][ASE ODBC Driver]Connection to the server has been lost. Connection died while reading from socket. Socket returned error code 10054. ERRNO returned 0. Check the server to determine the status of any open transactions.
This message points to problems with SAP. Contact SAP administrator and ask to check it there were any problem with SAP instance. You should also talk to network enigneer to verify if there was a problem with network connection.
On SSIS side everything looks fine.

How to solve MySQLDAC HTTP Tunnel connection

I want to connect to MySQL database using HTTP Tunnel (because port for remoting database is closed). I used mysqlDAC vcl for Delphi, when I was in design mode, i used GridView to display its data successfully.
But the problem when i compile the project, I always get this error :
Project WP.exe raised exception class HttpException with message 'Error on data reading from the connection:
A blocking operation was interrupted by a call to WSACancelBlockingCall.
Socket Error Code: 10004($2714)'. Process stopped. Use Step or Run to continue.
Can somebody help me to solve this problem? I think my connection setup is correct, because I can display the data on DBGrid when I set connection is true.

fail to connect to MySQL using IntelliJ IDEA

I wanted to use Hibernate, so I created a MySQL datasource by database of IntelliJ IDEA. But I got a problem that "connection to MySQL" failed.
I did not change any default setting and just added "demo" as database name.
Here is the description of the problem returned by IntelliJ IDEA.
Connection to MySQL - demo#localhost failed.
Communications link failure.
The last packet sent successfully to the server was 0 milliseconds ago.
The driver has not received any packets from the server.
(4s)
Sorry but there is no further information about the problem.
I granted IntelliJ IDEA the permission to access Internet since I can download packages via Maven dependencies, so probably there is not any problem with my Internet.

Visual Studio Update Wizard MySql

I am running Visual Studio 2010, and attempting to update my Entity Framework project using the Update Wizard. When I attempt to add a single table from the MySql database, the add tab will show the table that I am attempting to add, however when I click finish, I get the following error message.
Unable to generate the model because of the following exception: 'An error occurred while executing the command definition. See the inner exception for details.
Fatal error encountered during command execution.
Fatal error encountered attempting to read the resultset.
Reading from the stream has failed.
Attempted to read past the end of the stream.
I get the same error message if attempt to create the Entity Framework from scratch. In addition, Server Explorer shows that the connection is successful when I test it.
I have also contacted Host Gator who is hosting the database and they where not able to see any issues on their side.
The problem ended up being that our shared server, was not able to handle the Update Request from the Entity Connector Framework and was timing out. Once we moved our database over to a different server we no longer had an issue.