calling Oracle functions
Anthony Tuininga
anthony at computronix.com
Fri Sep 13 14:07:19 EDT 2002
On Fri, 2002-09-13 at 11:25, Дамјан Г. wrote:
>
> >> 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)
Sounds reasonable. I'll put it on my list of things to do.
>
>
>
>
>
> --
> Дамјан
>
> Intel: where Quality is job number 0.9998782345!
>
> --
> http://mail.python.org/mailman/listinfo/python-list
--
Anthony Tuininga
anthony at computronix.com
Computronix
Distinctive Software. Real People.
Suite 200, 10216 - 124 Street NW
Edmonton, AB, Canada T5N 4A3
Phone: (780) 454-3700
Fax: (780) 454-3838
http://www.computronix.com
More information about the Python-list
mailing list