package jdbc;
import java.io.PrintWriter;
import java.sql.*;
public class Driver {
public static void main(String[] args) {
try {
Connection myConn = DriverManager.getConnection("jdbc:mysql://localhost:80/entries",
"root",
"NULL");
Statement mystmt = myConn.createStatement();
ResultSet myRs =
mystmt.executeQuery("SELECT * FROM `entries` WHERE word LIKE '%ad' OR word LIKE '%act'");
while(myRs.next()) {
System.out.println(myRs.getString("word"));
}
}
catch(Exception e) {
e.printStackTrace();
}
}
}
上面是我的代码喜欢英语词典的sql数据库。为什么当我运行此代码时,我的查询结果没有显示?
答案 0 :(得分:0)
尝试在Sql Server上运行此查询。我觉得没有与where子句中定义的过滤creteria匹配的记录。