The InsertFixed method can be expand to illustrate how arguments are passed to Java methods.
The following method uses arguments passed in the call to the method as the values to insert:
public static void InsertArguments( String id, String name) { try { conn = DriverManager.getConnection( "jdbc:default:connection" ); String sqlStr = "INSERT INTO Department " + " ( dept_id, dept_name )" + " VALUES (" + id + ", '" + name + "')"; // Execute the statement Statement stmt = conn.createStatement(); Integer IRows = new Integer( stmt.executeUpdate( sqlStr.toString() ) ); // Print the number of rows updated System.out.println(IRows.toString() + " row inserted" ); } catch ( Exception e ) { System.out.println("Error: " + e.getMessage()); e.printStackTrace(); } }