It should just work
without any manual action. BUT
even though I personally pay a lot of attention to testing the upgrades between versions, I don't go 5 years back (wow, it really will be 5 years since 2.1 next month...) and doubt anybody really tested skipping so many releases. So !make a backup of the complete OpenCPN data directory
!, install 4.0 over your current
version and report back if the upgrade is problematic - we will have a look at it and migrate your data somehow.