Topic: [Microsoft][ODBC Microsoft Access Driver] FROM 子句语法错误。 |
Print this page |
1.[Microsoft][ODBC Microsoft Access Driver] FROM 子句语法错误。 | Copy to clipboard |
Posted by: neil99 Posted on: 2005-12-30 15:31 import java.sql.*; public class DataBase { public static void main(String [] args){ try{ String strurl="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=demo.mdb"; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection conn=DriverManager.getConnection(strurl,"","") ; Statement stmt=conn.createStatement(); String sql = "select * from table "; ResultSet rs=stmt.executeQuery(sql); while(rs.next()) System.out.println(rs.getString("name")); rs.close(); stmt.close(); conn.close(); } catch(ClassNotFoundException cnfe){ System.err.println(cnfe); } catch(SQLException sqle){ System.err.println(sqle); } } } 编译通过 运行时出现: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] FROM 子句语法错误。 不知道什么原因。急啊 |
2.Re:[Microsoft][ODBC Microsoft Access Driver] FROM 子句语法错误。 [Re: neil99] | Copy to clipboard |
Posted by: neil99 Posted on: 2005-12-30 16:01 知道了 表名table是SQL的保留字 改成其他的就好了 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |