谢谢你的分享,不过我启动tomcat时,报错。 log4j:ERROR Failed to excute sql com.microsoft.sqlserver.jdbc.SQLServerException: 到主机 的 TCP/IP 连接失败。 java.net.ConnectException: Connection timed out: connect at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source) at java.sql.DriverManager.getConnection(DriverManager.java:525) at java.sql.DriverManager.getConnection(DriverManager.java:171) at org.apache.log4j.jdbc.JDBCAppender.getConnection(JDBCAppender.java:197) at org.apache.log4j.jdbc.JDBCAppender.execute(JDBCAppender.java:160) at org.apache.log4j.jdbc.JDBCAppender.flushBuffer(JDBCAppender.java:235) at org.apache.log4j.jdbc.JDBCAppender.append(JDBCAppender.java:131) at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221) at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57) at org.apache.log4j.Category.callAppenders(Category.java:194) at org.apache.log4j.Category.forcedLog(Category.java:379) at org.apache.log4j.Category.info(Category.java:654) at keel.pool.DbPoolMgr.init(DbPoolMgr.java:42) at keel.pool.DbPoolMgr.<init>(DbPoolMgr.java:37) at keel.pool.DbPoolMgr.getInstance(DbPoolMgr.java:88) at keel.util.KeelPoolContextListener.contextInitialized(KeelPoolContextListener.java:16) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595) at org.apache.catalina.core.Standard