SQL Server 2008
1、连接SQLSERVER2008的字符串总出问题,JAVA编程还没入门,找几篇文章来解决问题:
http://dotnet.aspx.cc/article/dcedf194-ed02-4aca-aac2-585f9f37931e/read.aspx
http://msdn.microsoft.com/zh-cn/library/ms378526.aspx
http://hi.baidu.com/%BA%EC%B7%E3%D4%F2%CC%EC/blog/item/dcdf4adee737915395ee372a.html
http://dev.csdn.net/article/57/57678.shtm
http://hi.baidu.com/ytstudio/blog/item/083267f55fc8fe26bc310931.html
上面几篇文章基本上已经说得很清楚了,就是Microsoft SQL Server JDBC Driver的版本要注意,要1.2以上的,2.0(即sqljdbc4.jar)也出来了,都可以用,在微软官方可以下载。
简单的代码如下:
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
其中2008有个什么实例,比如这里的\SQLEXPRESS,可以不要了。前面一篇JS连接数据库的文章提到过这一点。
2、 Sql Server 2008也会出现“provider: 命名管道提供程序,error:40 - 无法打开Sql server连接”的问题。网上有很多解决办法。无非有以下几点:
(1) 服务器身份验证改为“SQL Server和Windows身份验证模式”并启用sa账户。
(2) 启用TCP/IP和Named Pipes,然后重启SQL Server服务。
(3) 连接字符串写正确,比如服务器使用SQLEXPRESS实例而不是MSSQLSERVER的需要在连接字符串后加上\\SQLEXPRESS。
具体如何操作,网上有非常详细的说明。可是有时候即使检查了再检查,搜索尽各种办法还是出现这种错误那就该反思了。很有可能是网络的原因,比如检查一下防火墙 。(20100618)