问题描述:
在DPA(Ignite)的管理监控界面发现有两台SQL Server数据库服务器连接不上,截图如下所示,检查其日志内容
具体错误日志如下所示, Notice:日志里面具体的服务器名称被我用ServerName替换了.
Date: 2/9/15 11:39:18 PM
DB: ServerName
com.confio.ignite.common.jdbc.exceptions.DatabaseConnectionException: A connection to the database could not be established: Invalid Host [cause=java.sql.SQLException: Unknown server host name 'ServerName'.]
at com.confio.ignite.common.jdbc.exceptions.ConnectionExceptionTranslator.translate(SourceFile:41)
at com.confio.idc.database.datasource.MonitoredDatabaseDataSource.getConnection(SourceFile:83)
at com.confio.idc.database.DatabaseMonitor.start(SourceFile:465)
at com.confio.idc.database.job.DatabaseMonitorLifecycleJob.execute(SourceFile:98)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: Unknown server host name 'ServerName'.
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:380)
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:183)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:148)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$Acqui
通过查看日志信息发现,也就是jdbc连接不上被监控的SQL Server服务器 A connection to the database could not be established: Invalid Host [cause=java.sql.SQLException: Unknown server host name 'ServerName'.]
我在部署DPA(Ignite)的Linux服务器上使用ping命令ping对应的服务器名称发现ping不通,而ping其ip地址则OK。原因是因为我们的DNS服务器出现了问题,而配置被监控的数据库服务器都是使用服务器名称,而没有使用IP地址(因为服务器名称比较容易记住),结果当DNS出现问题是,就出现了jdbc连接不到被监控的SQL Server数据库服务器。
[root@getlnx05 dpa_9_0_146]# ping ServerName
ping: unknown host ServerName
解决方法:
在被监控的SQL Server服务器上运行ipconfig /registerdns,如下所示,过上几分钟,在部署DPA(Ignite)的Linux服务器上就能ping通服务器名称了。问题解决。
C:Users>ipconfig /registerdns
Windows IP Configuration
Registration of the DNS resource records for all adapters of this computer has b
een initiated. Any errors will be reported in the Event Viewer in 15 minutes.
关于ipconfig /registerdns:表示可以使用该参数对失败的 DNS 名称注册进行疑难解答或解决客户和 DNS 服务器之间的动态更新问题,而不必重新启动客户计算机