组队-地铁查询
站点的建立
public class dao {
public String findbylin[]=new String[100];
int i=0;
public String findbylin(String lin) throws Exception {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection conn=DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/kebiao", "root", "123456");
String sql="select * from station_information";
Statement stmt= conn.createStatement();
ResultSet find=stmt.executeQuery(sql);
while(find.next()) {
if(find.getString(2).equals(lin)) {
findbylin[i]=new String();
findbylin[i]=find.getString(3);
i++;
}
}
if(findbylin[0].equals(null))return "###";
findbylin[i]="#";
find.close();
stmt.close();
conn.close();
return lin;
}