MyEclipse10连接SqlServer2008 驱动加载成功 但是连接不成功
加载驱动成功2015-2-209:42:02com.microsoft.sqlserver.jdbc.SQLServerConnectionPrelogin警告:Conn...
加载驱动成功
2015-2-20 9:42:02 com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
警告: ConnectionID:1 ClientConnectionId: 08a4bd1d-fd8a-4778-ab87-bd6de57ce46a Server major version:8 is not supported by this driver.
连接失败
com.microsoft.sqlserver.jdbc.SQLServerException: 该驱动程序不支持 SQL Server 8 版。 ClientConnectionId:08a4bd1d-fd8a-4778-ab87-bd6de57ce46a
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1667)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1654)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.Prelogin(SQLServerConnection.java:1556)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1319)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at com.lf.Hello.main(Hello.java:12)
编写运行的代码是
package com.lf;
import java.sql.*;
public class Hello
{
public static Connection con ;
public static void main(String[] args)
{
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
System.out.println("加载驱动成功");
con=DriverManager.getConnection
("jdbc:sqlserver://localhost:1433;DatabaseName=Text","邓爽","aa1224");
System.out.print("连接成功");
con.close();//测试结束,释放系统资源。
}
catch (Exception ex)
{
System.out.println("连接失败");
ex.printStackTrace();
} 展开
2015-2-20 9:42:02 com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
警告: ConnectionID:1 ClientConnectionId: 08a4bd1d-fd8a-4778-ab87-bd6de57ce46a Server major version:8 is not supported by this driver.
连接失败
com.microsoft.sqlserver.jdbc.SQLServerException: 该驱动程序不支持 SQL Server 8 版。 ClientConnectionId:08a4bd1d-fd8a-4778-ab87-bd6de57ce46a
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1667)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1654)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.Prelogin(SQLServerConnection.java:1556)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1319)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at com.lf.Hello.main(Hello.java:12)
编写运行的代码是
package com.lf;
import java.sql.*;
public class Hello
{
public static Connection con ;
public static void main(String[] args)
{
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
System.out.println("加载驱动成功");
con=DriverManager.getConnection
("jdbc:sqlserver://localhost:1433;DatabaseName=Text","邓爽","aa1224");
System.out.print("连接成功");
con.close();//测试结束,释放系统资源。
}
catch (Exception ex)
{
System.out.println("连接失败");
ex.printStackTrace();
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询