站点的建立
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;
}
标签:findbylin,String,lin,查询,组队,地铁,close,find,conn From: https://www.cnblogs.com/bu-dao-weng/p/17216555.html