calling Oracle functions
Дамјан Г.
пенгуиниста at маил?=.=?iso-8859-5?Q?нет?=.=?iso-8859-5?Q?мк
Fri Sep 13 13:25:16 EDT 2002
>> Now a simpler question:
>> is it possible to specify the data source name directly not through
>> the alias defined in tnsnames.ora. In perl DBD I can specify a
>> connection string like cs = "dbi:Oracle:host=1.10.100.200;sid=TEST"?
> cx_Oracle is passing the string directly to Oracle, so whatever it
> accepts, cx_Oracle will accept. Specifically, you can take the entire
> string that is in your tnsnames.ora file and pass it directly as in
> v_TNS =
> (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=opus)(PORT=1521)))(CONNECT_DATA=(SID=DEV)))
> v_Connection = cx_Oracle.connect("user", "pw", v_TNS)
> and that works just fine. Does that answer your question?
Yes. Thanks. I would only suggest that you can add a function to
cx_Oracle to make that big ugly string from 3 parameters.
something like:
def makeDSN(host,port,sid):
return """(DESCRIPTION= (ADDRESS_LIST= (ADDRESS= (PROTOCOL=TCP)
(HOST=%s) (PORT=%s))) (CONNECT_DATA=(SID=%s)))""" %
(host,port,sid)
--
Дамјан
Intel: where Quality is job number 0.9998782345!
More information about the Python-list
mailing list