[求助]连接数据库出错啦~
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");String url="jdbc:odbc:db";
Connection con=DriverManager.getConnection(url,"HP","aa");
//搜索选择题
Statement st1=con.createStatement();
String sql="SELECT * FROM CHOICE WHERE difficulty=难";
ResultSet rs1=st1.executeQuery(sql);
while(rs1.next()){
String str=rs1.getString("id");
System.out.println(str);
}
这是我代码其中一部分,但是运行后出错了...上面红色代码为出错部分,下面为异常出现后的提示
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] 参数不足,期待是 1。
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:253)
at olts.Gqbd.<init>(Gqbd.java:63)
at olts.Gqbd.main(Gqbd.java:95)