depends on the vehicle and you have to be careful. ODB ports are only spec'd for 4 amps officially, but it depends on what fuse they're running off. Interior lights, auto lamps/DRL, fancy radio head units and the like can draw quite a bit of power
You have to plug it in and keep the doors closed to ensure the vehicle won't draw too much power. If you accidentally open the door with the battery disconnected, there's a small chance you could blow a fuse and have to go hunting for it.
Typically, when I have the time or it's important to not lose settings like security codes, I will use a small 12V SLA battery with test leads to battery lugs or fuse panel under the hood.
With proper precautions taken, they're very convenient to have around and if it has a 2 pin sae connector, it can be used with a bunch of different battery maintainers and low amperage chargers.
Some of the Noco chargers have a 12V 3-5A maintain/supply mode that works well for this.
Just to be sure I understand, you'd rather use essentially a spare 12V lead-acid battery with jumper cables attached to the positive and negative battery cables than going through the OBDII port? Thanks.