Our current scenario is that we have 10 tomcat web tiers and 2 servers in production. We want to have ha-jdbc on all tomcat web tiers and let ha-jdbc manage the load balancing. In Test environment, I have one instance of tomcat running and using two servers. The issue is when the servers are in the same physical location, the cluster works fine (fail over and load balancing).However when the servers are in different location, the fail over fails.
I get this error: Could not find server 'server2' in sys.servers. Verify that the correct server name was specified.
Caused by: com.inet.tds.Tds4SQLException: Msg 7202, Level 11, State 2, Line 1, Sqlstate 01000 [SERVER1]Could not find server 'SERVER2' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.
at com.inet.tds.aa.a(Unknown Source)
at com.inet.tds.n.b(Unknown Source)
at com.inet.tds.n.a(Unknown Source)
at com.inet.tds.p.c(Unknown Source)
at com.inet.tds.p.a(Unknown Source)
at com.inet.tds.p.b(Unknown Source)
at com.inet.tds.bg.g(Unknown Source)
at com.inet.tds.bg.executeQuery(Unknown Source)
at com.inet.pool.u.executeQuery(Unknown Source)
at com.inet.pool.ac.executeQuery(Unknown Source)
at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.sf.hajdbc.util.reflect.Methods.invoke(Methods.java:49)
at net.sf.hajdbc.invocation.SimpleInvoker.invoke(SimpleInvoker.java:53)
at net.sf.hajdbc.balancer.AbstractSetBalancer.invoke(AbstractSetBalancer.java:77)
at net.sf.hajdbc.invocation.InvokeOnOneInvocationStrategy.invoke(InvokeOnOneInvocationStrategy.java:80)
at net.sf.hajdbc.invocation.InvocationStrategies.invoke(InvocationStrategies.java:35)
at net.sf.hajdbc.sql.AbstractInvocationHandler.invokeOnProxy(AbstractInvocationHandler.java:95)
at net.sf.hajdbc.sql.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:85)
at net.sf.hajdbc.sql.ChildInvocationHandler.invoke(ChildInvocationHandler.java:44)
at com.sun.proxy.$Proxy84.executeQuery(Unknown Source)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Our current scenario is that we have 10 tomcat web tiers and 2 servers in production. We want to have ha-jdbc on all tomcat web tiers and let ha-jdbc manage the load balancing. In Test environment, I have one instance of tomcat running and using two servers. The issue is when the servers are in the same physical location, the cluster works fine (fail over and load balancing).However when the servers are in different location, the fail over fails.
I get this error: Could not find server 'server2' in sys.servers. Verify that the correct server name was specified.
I am pretty new to this stuff,any help is really appreciated.
It looks like your definition for db2 is missing a databaseName and portNumber.
Thats just a copy paste error. In our actual file we have everything specified and still get the same error.
Can you paste the stacktrace of the exception? I'm not familiar with this jdbc driver.
Caused by: com.inet.tds.Tds4SQLException: Msg 7202, Level 11, State 2, Line 1, Sqlstate 01000
[SERVER1]Could not find server 'SERVER2' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.
at com.inet.tds.aa.a(Unknown Source)
at com.inet.tds.n.b(Unknown Source)
at com.inet.tds.n.a(Unknown Source)
at com.inet.tds.p.c(Unknown Source)
at com.inet.tds.p.a(Unknown Source)
at com.inet.tds.p.b(Unknown Source)
at com.inet.tds.bg.g(Unknown Source)
at com.inet.tds.bg.executeQuery(Unknown Source)
at com.inet.pool.u.executeQuery(Unknown Source)
at com.inet.pool.ac.executeQuery(Unknown Source)
at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.sf.hajdbc.util.reflect.Methods.invoke(Methods.java:49)
at net.sf.hajdbc.invocation.SimpleInvoker.invoke(SimpleInvoker.java:53)
at net.sf.hajdbc.balancer.AbstractSetBalancer.invoke(AbstractSetBalancer.java:77)
at net.sf.hajdbc.invocation.InvokeOnOneInvocationStrategy.invoke(InvokeOnOneInvocationStrategy.java:80)
at net.sf.hajdbc.invocation.InvocationStrategies.invoke(InvocationStrategies.java:35)
at net.sf.hajdbc.sql.AbstractInvocationHandler.invokeOnProxy(AbstractInvocationHandler.java:95)
at net.sf.hajdbc.sql.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:85)
at net.sf.hajdbc.sql.ChildInvocationHandler.invoke(ChildInvocationHandler.java:44)
at com.sun.proxy.$Proxy84.executeQuery(Unknown Source)