It seems a non-easy problem. firstly U can try :
instead of 
"jdbc:oracle:thin:@host:port:sid"
use a string of the form
"jdbc:oracle:thin:@(DESCRIPTION="                    +
                       "(ADDRESS_LIST="              + 
                           "(ADDRESS=(PROTOCOL=TCP)" + 
                                    "(HOST=host)"    +                                      =
                                    "(PORT=port)"    +
                           ")"                       +
                       ")"                           +
                       "(CONNECT_DATA="              +
                           "(SERVICE_NAME=sid)"      +
                           "(SERVER=DEDICATED)"      +
                       ")"                           +
                     ")"
This solve ur problem?