Hi,
If different packages are customized development and assigned to different DB connection name, there is a possibility you can use S_DBCON object to check though that is not the original intention as Lars mentioned.
Sample routine:
* Check authority to access the specified connection
IF con_name IS NOT INITIAL.
AUTHORITY-CHECK OBJECT 'S_DBCON'
ID 'DBA_DBHOST' FIELD space
ID 'DBA_DBSID' FIELD con_name
ID 'DBA_DBUSER' FIELD space
ID 'ACTVT' FIELD '03'.
ENDIF.
IF sy-subrc <> 0.
MESSAGE
'You are not authorized to run this program' TYPE 'I'.
RETURN.
A user without the assigned DB connection name is unable to execute objects in a package when that connection is not assigned to him.
Regards.
YS