Hi i need to the user to input the variables ( "name" and "id" ) and by prepared statement they are passed to sql query. plz help ... and i need to know how to copy the output in ResultSet to a variable so it can me used else where..? Code: import java.sql.*; public class File { public static void main(String s[]) throws SQLException,Exception{ Class.forName("com.ibm.db2.jcc.DB2Driver"); Connection con = DriverManager.getConnection("jdbc:db2:SMART","","" ); String name; int id; System.out.println("Enter a the id: "); System.out.println("\n\nEnter the name: "); String query = "insert into db2admin.enduser values (?,?)"; PreparedStatement ps=con.prepareStatement (query); ps.setInt(1,id); ps.setString(2,name); int i=ps.executeUpdate(); System.out.println("record inserted count:"+i); con.close(); } }