insert « db2 « Java Database Q&A





1. How can I return the generated keys to JDBC from a DB2 stored procedure that does an insert?    stackoverflow.com

I've got a simple stored procedure that does an insert to a table with an identity primary key column. I need to get the key that was generated by the ...

2. How to use NOT EXISTS with COMPOSITE KEYS in SQL for inserting data from POJO    stackoverflow.com

I am using DB2 DBMS. Scenario 1: myTable has a composite key (key1, key2) where both key1 and key2 are foreign keys from yourTable. I want to insert new data from yourTable into myTable, ...

3. problem insert with DB2    coderanch.com

I have this insert procedure public void insert (NodeInfo ni,DefaultMutableTreeNode parent) { DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(ni); model.insertNodeInto(newNode,parent,parent.getChildCount()); TreeNode[] nodes = model.getPathToRoot(newNode); TreePath path = new TreePath(nodes); tree.scrollPathToVisible(path); tree.setSelectionPath(path); try { String query = "SELECT * FROM CompanyItem"; ResultSet rs = stmt.executeQuery(query); rs.moveToInsertRow(); rs.updateInt("idItem",ni.getId()); rs.updateString("type",ni.getType()); rs.updateString("info",ni.getInfo()); rs.insertRow(); rs.close(); query = "SELECT * FROM Hierarchy"; rs = stmt.executeQuery(query); rs.moveToInsertRow(); rs.updateInt("idChild",ni.getId()); rs.updateInt("idParent",((NodeInfo)parent.getUserObject()).getId()); rs.insertRow(); ...

4. Insert into DB2    coderanch.com