Actually I want to copy some row from one db to another, changing a few things in the process. So I thought using an updatable result to do this is the easiest. But I don't know how to get a blank ResultSet to do update. Here is what I am thinking about doing: ... Statement s = c.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); ResultSet r = s.execute ??? <-- what to do? r.moveToInsertRow(); r.setObject(...); <-- copy from another ResultSet r.insertRow();
zou xiao fei
Joined: Oct 26, 2001
what DBMS are you using? some big ones support "select...into..." query,you need not use so complex method.
I'm not a big fan of updatable resultsets. I believe that you should get in and get out as fast as possible to alleviate database resources.
Joined: Oct 29, 2001
Since I don't really care about the content of the row I am copying, I don't want to compose the INSERT INTO sql. Just have the source ResultSet and destination ResultSet and take the value from the src and set them into the destination and just insert. I am dealing with two database servers. And I need to modify a few of the column before inserting into the second server. So I don't think SELECT INTO can work. So what is the simlest way using JDBC to copy rows from one db server to another, adjusting a few columns in the process, both servers have the same database schema?