java - How to specify port in JDBC connection URL for failoverPartner server in SQL Server -


i'm trying add server failover sql server , not using port 1443, i'm using port 2776. i'm trying specify tried didn't work. how that?

private string url = "jdbc:sqlserver://server1:2776;databasename=db;failoverpartner=server2"; 

i've tried following configs, none of them worked.

  1. ...failoverpartner=server2:2776
  2. ...failoverpartner=server2,2776
  3. ...failoverpartner=server2\\db

but everytime exception.

  1. com.microsoft.sqlserver.jdbc.sqlserverexception: tcp/ip connection host server2, port 1433 has failed. error: "connect timed out. verify connection properties, check instance of sql server running on host , accepting tcp/ip connections @ port, , no firewall blocking tcp connections port.".

  2. com.microsoft.sqlserver.jdbc.sqlserverexception: tcp/ip connection host server2:2776, port 1433 has failed. error: "null. verify connection properties, check instance of sql server running on host , accepting tcp/ip connections @ port, , no firewall blocking tcp connections port.".

  3. com.microsoft.sqlserver.jdbc.sqlserverexception: tcp/ip connection host server2, 2776, port 1433 has failed. error: "null. verify connection properties, check instance of sql server running on host , accepting tcp/ip connections @ port, , no firewall blocking tcp connections port.".

from documentation connecting sql server jdbc driver - setting connection properties documentation, property failoverpartner:

note: driver not support specifying server instance port number failover partner instance part of failoverpartner property in connection string. however, specifying servername, instancename , portnumber properties of principal server instance , failoverpartner property of failover partner instance in same connection string supported.

worded confusingly, looks can't specify port number failover server.


from kb-2284190 microsoft (applications cannot connect mirror partner server when using port number in failoverpartner attribute of connection string ) i'm pretty reading same:

cause

both error messages occur due fact sql server jdbc drivers (all versions) not support parsing of port number failoverpartner connection string attribute , rely on dns , sql server browser service (for named instances only) resolve connection information partner server. in environments wherein conditions discussed in symptoms sections met, jdbc driver not able resolve partner server information , hence error message discussed above.

this behavior of sql mirroring infrastructure design. reason, microsoft jdbc driver version 3.0 supports failover partner attribute value in format <server_name>[\<sql_server_instance_name>].

resolution

to work around problem, use 1 of following methods in environments database mirroring involved:

  • for default instances of sql server part of mirroring configuration ensure listening on default port 1433 tcp connections.

  • for named instances, ensure sql browser service running , port 1434 not blocked on network , server b not configured hidden instance.


in conclusion, 1 of following:

  • specify failover server listen on port 1433 tcp.
  • make named instance , specify failoverpartner server_name\instance_name. make sure sql server browser service running , port 1434 not blocked .

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -