Reputation: 23
I am upgrading my project from java 8 to 21 and springboot 2.x to 3.x, I am getting this error while connecting to microsoft server database.
Stack trace:
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (The TCP/IP connection to the host xyz, port 1071 has failed. Error: "Connect timed out. 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.".)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) ~[commons-dbcp-1.4.jar!/:1.4]
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) ~[commons-dbcp-1.4.jar!/:1.4]
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) ~[commons-dbcp-1.4.jar!/:1.4]
at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:160) ~[spring-jdbc-6.1.11.jar!/:6.1.11]
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:118) ~[spring-jdbc-6.1.11.jar!/:6.1.11]
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:81) ~[spring-jdbc-6.1.11.jar!/:6.1.11]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:388) ~[spring-jdbc-6.1.11.jar!/:6.1.11]
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:476) ~[spring-jdbc-6.1.11.jar!/:6.1.11]
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:486) ~[spring-jdbc-6.1.11.jar!/:6.1.11]
at
Upvotes: 0
Views: 80
Reputation: 36
Please follow this step and check.
Open Control Panel
> System And Security
> Windows Defender Firewall
> `Advanced Settings
Click on Inbound Rules
> New Rules
Port
from the optionTCP
and specified the Port No Or Select All Local Ports
Outbound Rules
SQL Server Configuration Manager
SQL Server Network Configuration
TCP/IP
and go to the IP Addresses
TCP Port
TCP/IP
PropertyUpvotes: 0