TDS 预登录响应不完整。目标服务器必须是 SQL Server 2000 或更高版本。
求解此异常:
信息: Loading Spring root WebApplicationContextDBCP borrowObject failed: com.microsoft.sqlserver.jdbc.SQLServerException: TDS 预登录响应不完整。目标服务器必须是 SQL Server 2000 或更高版本。2011-11-24 11:56:27 org.apache.catalina.core.StandardContext listenerStart严重: Exception sending context initialized event to listener instance of class org.appfuse.webapp.listener.StartupListenerorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/hibernate_context.xml]: Initialization of bean failed; nested exception is org.apache.commons.dbcp.DbcpException: com.microsoft.sqlserver.jdbc.SQLServerException: TDS 预登录响应不完整。目标服务器必须是 SQL Server 2000 或更高版本。org.apache.commons.dbcp.DbcpException: com.microsoft.sqlserver.jdbc.SQLServerException: TDS 预登录响应不完整。目标服务器必须是 SQL Server 2000 或更高版本。 at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:85) at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:184) at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1158) at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:117) at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:110) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312) at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:80) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:800) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:726) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1059) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:363) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:269) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:320) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) at org.appfuse.webapp.listener.StartupListener.contextInitialized(StartupListener.java:36) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:566) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
<driver-url>jdbc:sqlserver://192.168.2.4:1433;DatabaseName=dpc_feedback360;去掉最后的分号
[解决办法]
你可以简单的用你学java时最基本的写法去连接,
Class.forName();
这些方式去连接,你也连接不上,我发现可能就是这个问题,我猜你是在做测试吧?而且192.168这个ip不是你的地址把?
如果是跟我说的差不多,你是在用别人的电脑当目标服务器,那你的连接是绝对出问题的,你要打开你的一个配置,可以远程连接!因为sqlserver默认的是只能本地连接,所以你要找到程序---》sqlserver的外围应用配置---》
服务连接和应用配置器---》远程连接----》本地连接和远程连接,
只有这样你的192.168这些ip才能访问,
记住是你要访问的那台电脑要做这些设置,你的电脑不需要!你访问哪台,就把那台电脑的远程连接勾上!
然后在试试用你学java的时候最基本的连接方式试试能不能连接!
[解决办法]
sqlserver2005不需要打那个补丁吧。。2000的才需要打SP4,2005的需要换一个jar包。使用sqljdbc.jar