出现问题如下:(member为表名,member表肯定建了,里面也有数据记录,但连接SQL里的自带的表可以正常显示)
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对
象名 'member' 无效。
        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 Sour
ce)
        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 So
urce)
        at com.microsoft.jdbc.base.BaseStatement.executeQuery(Unknown Source)
        at DbTest.main(DbTest.java:19)

解决方案 »

  1.   

    请给出sql文 或者关键的代码
    你这样我没法确认
      

  2.   

    package com.info.katong.db;
    /**
     * 作成者:陈一男
     * 作成日:2005/11/7
     * 机能:数据库驱动程序
     * 测试者:陈一男
     * 测试结果:测试通过
     * */
    import java.sql.*;
    import com.microsoft.*;
    public class Dbdr
    {
        private String dirverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
        private String url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=dabinglian";
        private String user = "sa";
        private String password = "sa";    public Connection getConnection()
        {
            try
            {
                Class.forName(dirverName);
                return DriverManager.getConnection(url,user,password);
            }
            catch(Exception e)
            {
                e.printStackTrace();
                return null;
            }
        }
    上面的是驱动
    package com.info.katong.db;
    /**
     * 作成者:陈一男
     * 作成日:2005/11/7
     * 机能:数据库连接处理SQL语句类
     * 测试者:陈一男
     * 测试结果:测试通过
     * */
    import java.sql.*;
    import com.microsoft.*;
    public class DbCtr
    {
        //select - 只有涉及查询的时候用这个方法
        public ResultSet getEQ(Connection conn,String sql)
        {
            ResultSet rs = null;
            try {
                Statement stat = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                                                     ResultSet.CONCUR_UPDATABLE);
                rs = stat.executeQuery(sql);
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
            return rs;
        }
        //除了查询以外的操作都用这个方法
        public int getEU(Connection conn,String sql)
        {
            Statement stat = null;
            try
            {
                stat = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                                           ResultSet.CONCUR_UPDATABLE);
            } catch (SQLException ex)
            {
                System.out.println(ex);
            }
            int effectRow = 0;
            try
            {
                effectRow = stat.executeUpdate(sql);
            } catch (SQLException ex1)
            {
                System.out.println(ex1);
            }
            return effectRow;
        }
        //------------------------------------------------------------------------
        //测试程序
        public static void main(String args[])
        {
            int a= 0;
            DbCtr db = new DbCtr();
            Dbdr dbdr = new Dbdr();
            ResultSet rs = db.getEQ(dbdr.getConnection(),"select * from U_tab");
            try {
                while(rs.next())
                {
                    a = rs.getInt("id");
                    System.out.println(a);
                }
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
            System.out.println(a);
        }
    }
    这是我写的测试程序 ,你换一下表名 不会有问题的