java调用sqlite太郁闷,太诡异了?

我写的测试代码如下:[code="java"]
public void testOperation() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
{
System.out.println("testoperation is start");

         // String sql ="select * from test2";
           String sql ="select * from hostconfig";
          int count = 0 ;
          //conn = ConnectionManager.getConnection();
         // stmt = ConnectionManager.getStatement();
          try {
          ResultSet rs = stmt.executeQuery(sql);
            System.out.println("rs is:"+rs);
            String name =null;
            while(rs.next())
            {
                System.out.println("rs is next");
                name = rs.getString(1);
                System.out.println("name is:"+name);
                //rs.last();
            }
            count = rs.getRow();
            System.out.println("count is:"+count);
        } catch (SQLException e) {

            e.printStackTrace();
        }

        assertNotNull(stmt);

         // assertEquals(0, count);
      }

[/code]上面代码是可以跑通的,这时的sql语句是:select * from hostconfig 如果换一张表就出问题用我注掉的语句:select * from test2就报java.sql.SQLException: no such table: test2,问题是这张在数据库里是有的,用java调sqlite好像里只可以查询出hostconfig表,我建了几张表都查不出来,而且加查询条件时:select * from hostconfig where hostdc='0A'也查不出来记录,sqlite资料又少,快疯了。
[b]问题补充:[/b]
To bohemia:按你的代码报了这个错:java.sql.SQLException: database locked
[b]问题补充:[/b]
这个问题估计是我把sqlite目录拷来拷去导致的,现在ok了只是有乱码那。

我给你的语句报错了?

呵呵.那就不太了解了. 接触SQLLite不多,希望别人能给你更多帮助;

[quote]ResultSet rs = stmt.executeQuery(sql); [/quote]
在之前添加

[code="java"]
stmt.execute(create table person (name varchar(100),age int));

//插入数据
stmt.execute(insert into person values(steve,25));

//用SQL语句读出数据
ResultSet result = stmt.executeQuery(select * from person);
while(result.next()){
System.out.println(result.getString(1));
System.out.println(result.getInt(2));
}

[/code]

就知道连接的对不对了. .个人猜测;