Use CallableStatement.

Use the fomat:

	String sql = "{call getEmpName (?, ?)}";
	stmt = conn.prepareCall(sql);

	int empID = 102;
	stmt.setInt(1, empID); // This would set ID as 102
	// Because second parameter is OUT so register it
	stmt.registerOutParameter(2, java.sql.Types.VARCHAR);

	// Use execute method to run stored procedure.
	System.out.println("Executing stored procedure...");
	stmt.execute();

	// Retrieve employee name with getXXX method
	String empName = stmt.getString(2);