javax.servlet.ServletException:[Microsoft] [用于JDBC的SQLServer 2000驱动程序]在读取时检测到流结束

时间:2017-12-02 02:27:09

标签: java sql-server jsp jdbc

String sql = "SELECT 1 AS T Union SELECT 2 AS T Union SELECT 3 AS T \n";
sql += "Union SELECT 4 AS T Union SELECT 5 AS T Union SELECT 6 AS T\n";
sql += "Union SELECT 4 AS T Union SELECT 5 AS T Union SELECT 6 AS T\n";
.....Same Statement....
sql += "Union SELECT 4 AS T Union SELECT 5 AS T Union SELECT 6 AS T\n";  

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
String connStr = "jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=DBName;User=UserName;Password=Pwd;";
Connection con = DriverManager.getConnection(connStr);

Statement smt = con.createStatement();
ResultSet rst = smt.executeQuery(sql);

rst.close(); smt.close(); con.close();

Error

1 个答案:

答案 0 :(得分:1)

将驱动程序升级到SQL Server JDBC驱动程序版本6.2.2 问题解决了。
谢谢你的帮助。