sqlexception 异常 求助高手
来源:百度知道 编辑:UC知道 时间:2024/06/03 07:10:12
程序如下
package sql;
import java.sql.*;
public class SqlTesting {
public static void main(String args[]) {
String url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Northwind";
String user ="";
String password = "";
String sqlStr = "select CustomerID, CompanyName, ContactName from Customers";
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
System.out.println( "" );
Connection con = DriverManager.getConnection(url,user,password );
Statement st = con.createStatement();
ResultSet rs = st.executeQuery( sqlStr );
while(rs.next()) {
System.out.print(rs.getString("CustomerID") + " ");
System.out.print(rs.getString("CompanyName") + " ");
System.out.println(rs.getString("ContactName"));
package sql;
import java.sql.*;
public class SqlTesting {
public static void main(String args[]) {
String url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Northwind";
String user ="";
String password = "";
String sqlStr = "select CustomerID, CompanyName, ContactName from Customers";
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
System.out.println( "" );
Connection con = DriverManager.getConnection(url,user,password );
Statement st = con.createStatement();
ResultSet rs = st.executeQuery( sqlStr );
while(rs.next()) {
System.out.print(rs.getString("CustomerID") + " ");
System.out.print(rs.getString("CompanyName") + " ");
System.out.println(rs.getString("ContactName"));
你这是SQL Server 2000本身的问题,必须要打补丁。
你的SQL Server 2000需要打补丁,至少是sp3,我给你一个地址是sp4的, 你下栽安装就可以了。你可以自己上网搜索,或去微软网站下栽。你的这个问题就是没有打补丁。
http://www.onlinedown.net/soft/16338.htm
localhost改成计算机名或ip地址
连接字符串出错了,不过没用过爪哇,帮不了你,给你一个连接字符串网站吧:
http://www.connectionstrings.com/
sqlexception 异常 求助高手
SQLException 异常 谁来帮帮我啊
java.sql.SQLException: Io 异常: Read failed: Connection timed out
求助:java.sql.SQLException: IO 异常: Broken pipe
Java JDBC 的问题 会的近来看看抛异常SQLException
急救!!!异常详细信息: System.Data.SqlClient.SqlException: 第 1 行: 'where' 附近有语法错误。
未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中。
VB中的未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中。是怎么回事
用户代码未处理SqlException
用户代码未处理SqlException?