I'm working on a project where I'm trying to connect a java spring application to a MS SQL 2008 R2 Server. The connection class is pretty straightforward here:
package databaseAccess;
import java.sql.Driver;
import org.skife.jdbi.v2.*;
public class DBConnection {
DBI dbi;
public DBConnection open() {
String dbServerAddress = "jdbc:sqlserver://<ipaddress>:1433;databaseName=<DBName>;integratedSecurity=true";
String user = "<UserName>";
String password = "<Password>";
dbi = new DBI(dbServerAddress,user,password);
return this;
}
public Handle getHandle() {
return dbi.open();
}
}
When I run this I'm getting the error:
Exception in thread "main" org.skife.jdbi.v2.exceptions.UnableToObtainConnectionException: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 129.21.208.42, port 1433 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.skife.jdbi.v2.DBI.open(DBI.java:191)
at databaseAccess.DBConnection.getHandle(DBConnection.java:20)
at user.User.create(User.java:34)
at main.Application.main(Application.java:20)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 129.21.208.42, port 1433 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 com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:241)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2243)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:491)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1309)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.skife.jdbi.v2.DBI$3.openConnection(DBI.java:125)
at org.skife.jdbi.v2.DBI.open(DBI.java:180)
... 3 more
Now I've gone through a ton of other issues people have had and haven't been able to figure this out. The server's IPAII is active, enabled and the port is set to 1433. The firewall is open for that port on the server. I have JDBC setup and in the dll file is in my Java path, yet I'm still getting this error. Anyone have any ideas as to what I'm doing incorrectly?