Microsoft Jet数据库引擎找不到对象'G:\ DATA \ Sheet1 $ .XLS'

时间:2011-02-17 17:39:31

标签: java jdbc

我在执行下面的代码时遇到错误,它说Microsoft Jet数据库引擎无法找到对象'G:\ DATA \ Sheet1 $ .XLS'。确保对象存在,并且您正确拼写其名称和路径名称。 xls表是正确命名的,我不知道哪里是错误,这里是代码:

public static void main(String[] args) {

try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String url = "jdbc:odbc:accountmaster";
    Connection conn1 =DriverManager.getConnection(url,"","");
    Statement st = conn1.createStatement();
    String query = "Select * from [Sheet1$]";
    ResultSet rs = st.executeQuery(query);

    while (rs.next())
    {
        String s = rs.getString("AccountID");
        String s1 = rs.getString("ProjectID");
        String s2 = rs.getString("PositionID");
        insert_AM(s,s1,s2);
        getAMDetails();
        conn1.close();
    }

0 个答案:

没有答案