Access 数据库有三张表,分别为FCK_CHMX,FCK_ZXX,FCK_CQDB.现在要将三张表数据迁移到Oracle对应的三张表里。具体要怎么实现同时进行迁移三张表可以提高迁移效率。由于表中字段类型需要改变,所以不用odbc。需要写个java程序。求高手指导。我只写了一个方法迁移一张表的数据,能否帮忙整合成同时迁移三个表的代码
public void getAccess() throws FileNotFoundException{
BeanFactory factory=new XmlBeanFactory(new ClassPathResource("spring.xml"));
SqlMapClient sqlMapClient=(SqlMapClient) factory.getBean("sqlMapClient");
try{
initCon();
conn=DriverManager.getConnection(url,"","");
String sql="select * from fck_chmx";
st=conn.createStatement();
rs=st.executeQuery(sql);
String temp="";
sqlMapClient.startTransaction();
while(rs.next()){
try{
Map map =new HashMap();
map.put("HOUSE_SIGN",rs.getString("户标识").trim().toString());
error=(String)map.get("HOUSE_SIGN");
map.put("ZL",rs.getString("坐落").trim().toString());
map.put("CH_BUILDING_NAME", rs.getString("逻辑幢名").trim().toString());
map.put("DOOR_NUMBER", rs.getString("门牌号").trim().toString());
map.put("ROOM_NUMBER", rs.getString("单元号").trim().toString());
map.put("FLAREA", rs.getString("实测面积").trim().toString());
map.put("PRIV_FLAREA", rs.getString("实测套内").trim().toString());
map.put("EX_FLAREA", rs.getString("实测阳台").trim().toString());
map.put("CO_FLAREA", rs.getString("实测公摊").trim().toString());
map.put("PRO_AREA", rs.getString("分摊用地").trim().toString());
map.put("FLOOR", rs.getString("楼层号").trim().toString());
map.put("FLOOR_NAME", rs.getString("层次").trim().toString());
map.put("HOUSE_USE_DESC", rs.getString("房屋用途").trim().toString());
map.put("JCNF", rs.getString("建成年份").trim().toString());
map.put("XMMC", rs.getString("项目名称").trim().toString());
map.put("ZDH", rs.getString("宗地号").trim().toString());
map.put("ZDMJ", rs.getString("宗地面积").trim().toString());
map.put("BUILDING_NAME", rs.getString("幢名").trim().toString());
map.put("BUILDING_SIGN", rs.getString("幢ID").trim().toString());
map.put("VIRFLAT_TYPE", rs.getString("是否权属单元").trim().toString());
map.put("SJZLDW", rs.getString("数据整理单位").trim().toString());
map.put("FCSJKZZID", rs.getString("房产数据库中幢ID").trim().toString());
map.put("SJZLRY", rs.getString("数据整理人员").trim().toString());
temp=rs.getString("备注").trim().toString();
if(!temp.equals("")){
map.put("BZ", temp);
}else{
map.put("BZ", "");
}
map.put("SJLX", rs.getString("数据类型").trim().toString());
map.put("CHMX_ID", rs.getString("CHMX_ID").trim().toString());
sqlMapClient.insert("XMXXK.insertfckchmx",map);
}catch(Exception e){
e.printStackTrace();
pw = new PrintWriter(new FileOutputStream("D://errorInfomation.log",
true));
pw.println("HOUSE_SIGN" + error + "未能插入成功!时间:" + new Date());
StackTraceElement[] ss = e.getStackTrace();
pw.println(e.fillInStackTrace());
for (int w = 0; w < ss.length; w++) {
pw.println(ss[w]);
}
pw.flush();