When we connect to Oracle , beside the host/port , username/password , there is another important parameter is SID or Service_name . I’m not an Oracle expert but i think SID and Service_name , sometimes we are given a name but we are not sure if it’s SID or service_name

This code below will use it as a SID:

client = cx_Oracle.connect(args.user, password,args.hostname+":"+args.port+"/"+args.db_name) 

In the case below i believe a dns like this was created:

dsn=cx_Oracle.makedsn(args.hostname, args.port, sevice_name=args.db_name)


The code below will use it as an server_name

dsn=cx_Oracle.makedsn(args.hostname, args.port, args.db_name)
client = cx_Oracle.connect(user=args.user, password=password,dsn=dsn)