<pre name="code" class="java">// 词典检查
public static boolean dictionaryChk(List<String> nameList) {
try{
String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};" +
"DBQ=src\\main\\resources\\EnglishWords.MDB";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection(url);
System.out.println(conn);
Statement sta = conn.createStatement();
for (String name : nameList) {
if (name.length() > 0) {
ResultSet resu = sta.executeQuery("select * from cetsix where words = '" +
name.toLowerCase() + "'");
if(!resu.next()){
return false;
}
}
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}