在eclispe中建了个te工程代码为:
import java.sql. *;public class te{
 public static void main(String[] args) {
  String driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
  String dbURL = "jdbc:microsoft:sqlserver://localhost:1433; DatabaseName=myfirst"; //smxc数据库名称
  String userName = "sa";
  String userPwd = "5473868a";
  Connection con ;
  try {
  Class.forName(driverName);
  con = DriverManager.getConnection(dbURL, userName, userPwd);
  System.out.println("Connection Successful!");
  Statement stmt=con.createStatement();  ResultSet rs=stmt.executeQuery("select * from student");
  while(rs.next()){
  String sno = rs.getString("sno");
  String sname = rs.getString("sname");
  String ssex = rs.getString("ssex");
  System.out.println(sno+"    "+sname+"      "+ssex);
  }
  }
  catch (Exception e) {
  e.printStackTrace();
  }
  }}在SQL 中建了个myfirst数据库,也建了student表
200215121  李勇                 男 20 CS                  
200215122  刘晨                 女 19 CS                  
200215123  王敏                 女 18 MA                  
200215125  张立                 男 19 IS                  
但是出现错误代码:
Connection Successful!
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 'student' 无效。
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeQuery(Unknown Source)
at te.main(te.java:16)
为什么呢请大家帮个忙