:1.因为sqlexpress服务器默认是禁用的并且端口号没有配置,所以要进行重新设置
2.如果你以前用java连接sql server 2000的话就要注意了:
在sql server 2000 中加载驱动和URL路径的语句是
其实你懂得String driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String dbURL = "jdbc:microsoft:sqlserver://localhost:1433; DatabaseName=rs";
而sql server 2005 中加载驱动和url的语句则为
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String dbURL = "jdbc:sqlserver://localhost:1433; DatabaseName=rs";
如果写法错误将会不到驱动.
sqlserver数据库:java连接sqlserver2005数据库心得体会
首先得下载驱动程序到微软网站下载Microsoft SQL Server 2005 JDBC Driver 1.2解压Microsoft SQL Server 2005 jdbc
得到sqljdbc.jar,用得时候直接加到classpath中去.
设置SQL Server服务器
防止出现
view plaincopy to clipboardprint?
com.microsoft.sqlserver.jdbc.SQLServerException: 到主机的TCP/IP 连接失败。
带反义词的成语at
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unkn own Source)
新手画小白兔怎么画at
com.microsoft.sqlserver.tHelper(Unknown Source)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Un known Source)
at com.microsoft.sqlserver.t(Unknown Source)
at com.microsoft.sqlserver.t(Unknown Source)
at java.Connection(Unknown Source)
at java.Connection(Unknown Source)
at Con(GetConnection.java:11)
at AllNotes(GetNotes.java:13)
at Servlets.GetFull.doGet(GetFull.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.ApplicationFilterChain.internalDoFilter(Ap plicationFilterChain.java:2 90)
at
org.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:206) at
org.StandardWrapperValve.invoke(StandardWrappe rValve.java:233) at
org.StandardContextValve.invoke(StandardContextValv e.java:175) at
org.StandardHostValve.invoke(StandardHostValve.java :128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :102)
at
org.StandardEngineValve.invoke(StandardEngineValve. java:109)
com.microsoft.sqlserver.jdbc.SQLServerException: 到主机的TCP/IP 连接失败。
at
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unkn own Source) at
com.microsoft.sqlserver.tHelper(Unknown Source)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Un known Source) at
com.microsoft.sqlserver.t(Unknown Source)
at com.microsoft.sqlserver.t(Unknown Source)
at java.Connection(Unknown Source)
at java.Connection(Unknown Source)办银行卡需要什么
淘宝里怎么领优惠券at Con(GetConnection.java:11)
at AllNotes(GetNotes.java:13)
at Servlets.GetFull.doGet(GetFull.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.ApplicationFilterChain.internalDoFilter(Ap plicationFilterChain.java:2 90)
at
org.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:206)
at
org.StandardWrapperValve.invoke(StandardWrapperValv e.java:233) at
org.StandardContextValve.invoke(StandardContextValv e.java:175)
at
org.StandardHostValve.invoke(StandardHostValve.java :128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :102)
at合资自主品牌
org.StandardEngineValve.invoke(StandardEngineValve. java:109)
我使用的是SQL Server 2005标准版SP2,这些都默认即可,一般不用配置。如果需要配置端口请看下面。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论