connection=cx_Oracle.connect(tp/tp@ocn_test) #查看tns alias命令 cmdtnsping ocn_test TNS Ping Utility forLinux: Version 9.2.0.8.0-Production on 27-SEP-201110:47:48 Copyright (c) 1997,2006, Oracle Corporation. Allrights reserved. Used parameter files: /opt/……/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION =(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.20.36.19)(PORT=1520))) (CONNECT_DATA =(SID=ocntest))) OK (10msec)2. 用户输入密码连接