This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I am trying to retreive data from sql db tables, and insert into oracale db table.before inserting into oracle table i have to check the modified date column in oracle. if sql table is having updated data i have to insert.
I am using jdbc api. I got connected to both databases and retreived data from databases. the code i wrote is below, but am stucked at comparing the data and inserting into oracle. please help me.......
Thanks in advanse ---------------------------------------------------------------------------
finally { try { if (stmt != null) stmt.close(); } catch (Exception ee) { } try { if (con != null) con.close(); } catch (Exception c) { } }
}
public void read2() throws SQLException { con = getOracleConnection("system", "murthy"); Statement stmt = con.createStatement(); String query = "select * from tb_User"; ResultSet res1 = stmt.executeQuery(query); while (res1.next()) {
String data = res1.getString(8);
} }
public static void main(String[] args) throws SQLException { Conn connect = new Conn(); connect.read(); connect.read2();
}
} I am unable to compare the two resultset objects. I have to compare them based on that i have to either update the row in oracle db or insert the row into oracle db.
I am trying to compare the objects in main method.
I tried arraylist,<pojo> they are not working. can you give me idea how to compare the objects. if i use the resultset object it is saying like resultset is not having any row it is closed.
If you intend to store the details about when the record was inserted or last updated shouldn't you also have a column for the Timestamp value of insertion/updation. If you have such a column in both these database tables, you can then fetch its value for both and a comparison would let you know whether you need to insert or update.
Cheers, Raj.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.