日期:2014-05-18 浏览次数:20762 次
public tempSQL() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } try { String user = ""; String password = ""; con = DriverManager.getConnection("jdbc:odbc:weizhangchaxun", user, password); st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); StringBuffer str = new StringBuffer(); ResultSet rs = st.executeQuery("Select * FROM CAR_INFO"); while (rs.next()) { // insert into zhifa_car_info // (id,f_carnoall,f_casedatetime,f_caseaddress,f_cartimelimit,f_organisename,f_carinformno,f_paccancytimes) // values(1717,'浙61373','2006-07-17 16:08:00.0','大u27813 水u22836 路,'2006-07-31 00:00:00.0','大u27813 中u-27105 ','0046467','1'); str.append("insert into zhifa_car_info"); str.append("(id,f_carnoall,f_casedatetime,f_caseaddress,f_cartimelimit,f_organisename,f_carinformno,f_paccancytimes) "); str.append("values("+rs.getString(1)+",'"+rs.getString(2)+"','"+rs.getString(3)+"','"+rs.getString(4)+"','"+rs.getString(5)+"','"+rs.getString(6)+"','"+rs.getString(7)+"','"+rs.getString(8)+"');\n"); } result=str.toString(); if (rs != null) { rs.close(); rs = null; st.close(); st = null; con.close(); con = null; } } catch (SQLException e) { e.printStackTrace(); } }
------解决方案--------------------
写个.bat处理导出
然后再action里 调用bat
你看成不
------解决方案--------------------
oralce有备份数据库得命令:
exp 备份成数据文件 ,备份时候可以选择安表备份,还是按用户备份等。
imp 把数据文件还原到数据库