public static void main(String[] args) {
Hashtable hs = queryFilterInfo();
Connection conn = null;
ResultSet rs = null;
String sql = null;
//转化Enumeration
Enumeration en = hs.keys();
while(en.hasMoreElements()){
//取得keys值
Object keys = en.nextElement();
//取得数组
String[] info =(String[])hs.get(keys);
sql = "update log_spmo_200704 set province='" + info[0] + "',log_spmo_200704.city='" + info[1] + "' where phone like '"+info[2]+"%'";
}
}
/*-----------------------*/
/*=======================*/
public static Hashtable queryFilterInfo()
{
String filename = "tel_province.txt";
Hashtable ht = new Hashtable();
BufferedReader reader = null;
File logFilef = new File("E:\\工作资料\\work\\tel_province.txt");
try {
reader = new BufferedReader(new FileReader(logFilef));
String line;
while( (line=reader.readLine())!=null )
{
String info[] = line.split(",");
ht.put(info[2],info);
}
}
catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally{
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return ht;
}
Hashtable hs = queryFilterInfo();
Connection conn = null;
ResultSet rs = null;
String sql = null;
//转化Enumeration
Enumeration en = hs.keys();
while(en.hasMoreElements()){
//取得keys值
Object keys = en.nextElement();
//取得数组
String[] info =(String[])hs.get(keys);
sql = "update log_spmo_200704 set province='" + info[0] + "',log_spmo_200704.city='" + info[1] + "' where phone like '"+info[2]+"%'";
}
}
/*-----------------------*/
/*=======================*/
public static Hashtable queryFilterInfo()
{
String filename = "tel_province.txt";
Hashtable ht = new Hashtable();
BufferedReader reader = null;
File logFilef = new File("E:\\工作资料\\work\\tel_province.txt");
try {
reader = new BufferedReader(new FileReader(logFilef));
String line;
while( (line=reader.readLine())!=null )
{
String info[] = line.split(",");
ht.put(info[2],info);
}
}
catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally{
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return ht;
}