Something very strange happened, I'm doing a web application in java with app engine and sql server using rest services, everything works apparently fine, but only once, that is, I have an endpoint that connects to a database and runs a Store Procedure, when I connect to the endpoint for the first time it works correctly, but when I do it for the second time it throws me the following error:
Connection timed out: no further information. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP / IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.
It's very strange, because I have other applications that connect to the same database, which also use app engine, which use the same sql driver and have no problem. I have not been able to see what is different about this.
Error function:
@Override
public void register() throws DatabaseException {
try (Connection connection = DriverManager.getConnection("jdbc:sqlserver://xx.xxx.xxx.xx;databaseName=mydatabase", Config.USER, Config.PASSWORD);
PreparedStatement preparedStatement
= connection.prepareStatement("execute store_procedure")) {
preparedStatement.executeQuery();
} catch (SQLException e) {
Logger.getGlobal().log(Level.SEVERE, e.getMessage());
throw new DatabaseException();
}
}
Pom:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.2.0.jre8</version>
</dependency>