Thread: Re: [cx-oracle-users] connect from a remote box
Brought to you by:
atuining
From: <ama...@ub...> - 2005-03-09 08:49:16
|
Klaus Boehm wrote: > i try to connect to a oracle db. > this db runs on another server. > now i have problem with the connect string. > > connect([user, password, dsn, mode, handle, pool, threaded, twophase]) > > how looks the dsn if i try to connect from a remote box? If you know how to connect with sql*plus, you've already typed a connection string like "<user>/<password>@<dsn>". So it's easy. Else, you must know the name of the server, and the name of the database on the server (the service name). If you installed the Oracle client version 10g, the dsn is simply dsn = "<server>/<service>" With a 8i or 9i Oracle client, it's more complicated: dsn = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST =<server>)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=<service>)))" (All in one string, you may add spaces if you want) You may want to have a (short) alias for this long string, in this case you must edit the tnsnames.ora file. But this is another story. Hope this helps, -- Amaury Forgeot d'Arc |
From: <ama...@ub...> - 2005-03-09 17:06:32
|
Klaus Boehm wrote: > cx_Oracle.DatabaseError: > ORA-12545: Connect failed because target host or object does not exist in your dsn, you have written the HOST= parameter between quotes. If I do the same, I also get the same error. Remove the quotes and retry! -- Amaury Forgeot d'Arc |
From: Klaus B. <k....@ew...> - 2005-03-09 13:09:45
|
ama...@ub... wrote: > Klaus Boehm wrote: > >>i try to connect to a oracle db. >>this db runs on another server. >>now i have problem with the connect string. >> >>connect([user, password, dsn, mode, handle, pool, threaded, twophase]) >> >>how looks the dsn if i try to connect from a remote box? > > > If you know how to connect with sql*plus, you've already typed a > connection string like "<user>/<password>@<dsn>". So it's easy. > > > Else, you must know the name of the server, and the name of the database > on the server (the service name). > > If you installed the Oracle client version 10g, the dsn is simply > dsn = "<server>/<service>" > > With a 8i or 9i Oracle client, it's more complicated: > dsn = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST > =<server>)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=<service>)))" > (All in one string, you may add spaces if you want) > You may want to have a (short) alias for this long string, in this case > you must edit the tnsnames.ora file. But this is another story. > > Hope this helps, > > -- > Amaury Forgeot d'Arc > > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > Now i have the correct dsn. dsn = "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST='db-os.dmg.ewt.de')(PORT=1521)))(CONNECT_DATA=(SID=OSPROD)))" connection = cx_Oracle.connect("xxxx", "yyyy", dsn) i get the following error: RuntimeError: Unable to acquire Oracle environment handle have anyone a idea? Klaus -- --------------------------------------------- Klaus Boehm Systemadministrator ewt gmbh D-86152 Augsburg, Volkhartstr. 4-6 Phone: +49.(0)821.3106-319 Fax: +49.(0)821.310660-319 mailto:k....@ew... http://www.ewt.de http://www.surf-club.de --------------------------------------------- |
From: Marcos P. <ma...@bu...> - 2005-03-09 13:24:22
|
Is ORACLE_HOME defined? El mi=C3=A9, 09-03-2005 a las 14:06 +0100, Klaus Boehm escribi=C3=B3: > ama...@ub... wrote: > > Klaus Boehm wrote: > >=20 > >>i try to connect to a oracle db. > >>this db runs on another server. > >>now i have problem with the connect string. > >> > >>connect([user, password, dsn, mode, handle, pool, threaded, twophase]= ) > >> > >>how looks the dsn if i try to connect from a remote box? > >=20 > >=20 > > If you know how to connect with sql*plus, you've already typed a > > connection string like "<user>/<password>@<dsn>". So it's easy. > >=20 > >=20 > > Else, you must know the name of the server, and the name of the datab= ase > > on the server (the service name). > >=20 > > If you installed the Oracle client version 10g, the dsn is simply > > dsn =3D "<server>/<service>" > >=20 > > With a 8i or 9i Oracle client, it's more complicated: > > dsn =3D "(DESCRIPTION=3D(ADDRESS=3D(PROTOCOL=3DTCP)(HOST > > =3D<server>)(PORT=3D1521))(CONNECT_DATA=3D(SERVICE_NAME=3D<service>))= )" > > (All in one string, you may add spaces if you want) > > You may want to have a (short) alias for this long string, in this ca= se > > you must edit the tnsnames.ora file. But this is another story. > >=20 > > Hope this helps, > >=20 > > -- > > Amaury Forgeot d'Arc > >=20 > >=20 > >=20 > >=20 > > ------------------------------------------------------- > > SF email is sponsored by - The IT Product Guide > > Read honest & candid reviews on hundreds of IT Products from real use= rs. > > Discover which products truly live up to the hype. Start reading now. > > http://ads.osdn.com/?ad_id=3D6595&alloc_id=3D14396&op=3Dclick > > _______________________________________________ > > cx-oracle-users mailing list > > cx-...@li... > > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > >=20 > Now i have the correct dsn. >=20 >=20 > dsn =3D=20 > "(DESCRIPTION=3D(ADDRESS_LIST=3D(ADDRESS=3D(PROTOCOL=3DTCP)(HOST=3D'db-= os.dmg.ewt.de')(PORT=3D1521)))(CONNECT_DATA=3D(SID=3DOSPROD)))" >=20 > connection =3D cx_Oracle.connect("xxxx", "yyyy", dsn) >=20 > i get the following error: >=20 > RuntimeError: Unable to acquire Oracle environment handle >=20 > have anyone a idea? >=20 >=20 > Klaus >=20 |
From: Anthony T. <ant...@gm...> - 2005-03-09 14:42:04
|
If the suggestions already given in this thread are not enough to solve the problem we'll need to know the client OS, the version of the Oracle client that you are using and the version of cx_Oracle that you are using. On Wed, 09 Mar 2005 14:24:07 +0100, Marcos S=E1nchez Provencio <ma...@bu...> wrote: > Is ORACLE_HOME defined? >=20 > El mi=E9, 09-03-2005 a las 14:06 +0100, Klaus Boehm escribi=F3: > > ama...@ub... wrote: > > > Klaus Boehm wrote: > > > > > >>i try to connect to a oracle db. > > >>this db runs on another server. > > >>now i have problem with the connect string. > > >> > > >>connect([user, password, dsn, mode, handle, pool, threaded, twophase]= ) > > >> > > >>how looks the dsn if i try to connect from a remote box? > > > > > > > > > If you know how to connect with sql*plus, you've already typed a > > > connection string like "<user>/<password>@<dsn>". So it's easy. > > > > > > > > > Else, you must know the name of the server, and the name of the datab= ase > > > on the server (the service name). > > > > > > If you installed the Oracle client version 10g, the dsn is simply > > > dsn =3D "<server>/<service>" > > > > > > With a 8i or 9i Oracle client, it's more complicated: > > > dsn =3D "(DESCRIPTION=3D(ADDRESS=3D(PROTOCOL=3DTCP)(HOST > > > =3D<server>)(PORT=3D1521))(CONNECT_DATA=3D(SERVICE_NAME=3D<service>))= )" > > > (All in one string, you may add spaces if you want) > > > You may want to have a (short) alias for this long string, in this ca= se > > > you must edit the tnsnames.ora file. But this is another story. > > > > > > Hope this helps, > > > > > > -- > > > Amaury Forgeot d'Arc > > > > > > > > > > > > > > > ------------------------------------------------------- > > > SF email is sponsored by - The IT Product Guide > > > Read honest & candid reviews on hundreds of IT Products from real use= rs. > > > Discover which products truly live up to the hype. Start reading now. > > > http://ads.osdn.com/?ad_id=3D6595&alloc_id=3D14396&op=3Dclick > > > _______________________________________________ > > > cx-oracle-users mailing list > > > cx-...@li... > > > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > > > Now i have the correct dsn. > > > > > > dsn =3D > > "(DESCRIPTION=3D(ADDRESS_LIST=3D(ADDRESS=3D(PROTOCOL=3DTCP)(HOST=3D'db-= os.dmg.ewt.de')(PORT=3D1521)))(CONNECT_DATA=3D(SID=3DOSPROD)))" > > > > connection =3D cx_Oracle.connect("xxxx", "yyyy", dsn) > > > > i get the following error: > > > > RuntimeError: Unable to acquire Oracle environment handle > > > > have anyone a idea? > > > > > > Klaus > > >=20 > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_ide95&alloc_id=14396&opclick > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: Klaus B. <k....@ew...> - 2005-03-09 15:02:59
|
My client OS is Debian woody. Oracle Client is 9i. cx_Oracle-4.1-9i-py23-1.i386.rpm Now i have defined the ORACLE_HOME Variable. i have a new error message: cx_Oracle.DatabaseError: ORA-12545: Connect failed because target host or object does not exist i have a tcpdump running on my nic: tcpdump -i eth0 dst port 1521 but i see no traffic on eth0 it seems there is no try from the remote host to connect to the db-server. > If the suggestions already given in this thread are not enough to > solve the problem we'll need to know the client OS, the version of the > Oracle client that you are using and the version of cx_Oracle that you > are using. > > On Wed, 09 Mar 2005 14:24:07 +0100, Marcos Sánchez Provencio > <ma...@bu...> wrote: > >>Is ORACLE_HOME defined? >> >>El mié, 09-03-2005 a las 14:06 +0100, Klaus Boehm escribió: >> >>>ama...@ub... wrote: >>> >>>>Klaus Boehm wrote: >>>> >>>> >>>>>i try to connect to a oracle db. >>>>>this db runs on another server. >>>>>now i have problem with the connect string. >>>>> >>>>>connect([user, password, dsn, mode, handle, pool, threaded, twophase]) >>>>> >>>>>how looks the dsn if i try to connect from a remote box? >>>> >>>> >>>>If you know how to connect with sql*plus, you've already typed a >>>>connection string like "<user>/<password>@<dsn>". So it's easy. >>>> >>>> >>>>Else, you must know the name of the server, and the name of the database >>>>on the server (the service name). >>>> >>>>If you installed the Oracle client version 10g, the dsn is simply >>>>dsn = "<server>/<service>" >>>> >>>>With a 8i or 9i Oracle client, it's more complicated: >>>>dsn = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST >>>>=<server>)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=<service>)))" >>>>(All in one string, you may add spaces if you want) >>>>You may want to have a (short) alias for this long string, in this case >>>>you must edit the tnsnames.ora file. But this is another story. >>>> >>>>Hope this helps, >>>> >>>>-- >>>>Amaury Forgeot d'Arc >>>> >>>> >>>> >>>> >>>>------------------------------------------------------- >>>>SF email is sponsored by - The IT Product Guide >>>>Read honest & candid reviews on hundreds of IT Products from real users. >>>>Discover which products truly live up to the hype. Start reading now. >>>>http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >>>>_______________________________________________ >>>>cx-oracle-users mailing list >>>>cx-...@li... >>>>https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>> >>> >>>Now i have the correct dsn. >>> >>> >>> dsn = >>>"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST='db-os.dmg.ewt.de')(PORT=1521)))(CONNECT_DATA=(SID=OSPROD)))" >>> >>>connection = cx_Oracle.connect("xxxx", "yyyy", dsn) >>> >>>i get the following error: >>> >>>RuntimeError: Unable to acquire Oracle environment handle >>> >>>have anyone a idea? >>> >>> >>>Klaus >>> >> >>------------------------------------------------------- >>SF email is sponsored by - The IT Product Guide >>Read honest & candid reviews on hundreds of IT Products from real users. >>Discover which products truly live up to the hype. Start reading now. >>http://ads.osdn.com/?ad_ide95&alloc_id396&opclick >>_______________________________________________ >>cx-oracle-users mailing list >>cx-...@li... >>https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_ide95&alloc_id396&op=click > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > -- --------------------------------------------- Klaus Boehm Systemadministrator ewt gmbh D-86152 Augsburg, Volkhartstr. 4-6 Phone: +49.(0)821.3106-319 Fax: +49.(0)821.310660-319 mailto:k....@ew... http://www.ewt.de http://www.surf-club.de --------------------------------------------- |
From: Marcos P. <ma...@bu...> - 2005-03-09 16:01:27
|
My experience: import cx_Oracle as cx #This is one line dsn=3D"(DESCRIPTION=3D(ADDRESS=3D(PROTOCOL=3DTCP)(HOST=3Drioja.proteus)(P= ORT=3D1521)) ( CONNECT_DATA=3D(SERVICE_NAME=3Dmaster9)))" c=3Dcx.connect('system/manager@'+dsn)=20 connects fine. Trobleshooting: ping rioja.proteus [shoud receive ping answer] telnet rioja.proteus 1521 [should hang waiting for input but not refuse connection] $ORACLE_HOME/bin/sqlplus 'system/salta@(DESCRIPTION=3D(ADDRESS=3D(PROTOCOL=3DTCP) (HOST=3Drioja.proteus)(PORT=3D1521))(CONNECT_DATA=3D(SERVICE_NAME=3Dmaste= r9)))' [should connect] Ask your dba :-) El mi=C3=A9, 09-03-2005 a las 15:59 +0100, Klaus Boehm escribi=C3=B3: > My client OS is Debian woody. > Oracle Client is 9i. > cx_Oracle-4.1-9i-py23-1.i386.rpm >=20 > Now i have defined the ORACLE_HOME Variable. >=20 > i have a new error message: >=20 >=20 > cx_Oracle.DatabaseError: ORA-12545: Connect failed because target host = or object=20 > does not exist >=20 > i have a tcpdump running on my nic: >=20 > tcpdump -i eth0 dst port 1521 >=20 > but i see no traffic on eth0 >=20 > it seems there is no try from the remote host to connect to > the db-server. >=20 > > If the suggestions already given in this thread are not enough to > > solve the problem we'll need to know the client OS, the version of th= e > > Oracle client that you are using and the version of cx_Oracle that yo= u > > are using. > >=20 > > On Wed, 09 Mar 2005 14:24:07 +0100, Marcos S=C3=A1nchez Provencio > > <ma...@bu...> wrote: > >=20 > >>Is ORACLE_HOME defined? > >> > >>El mi=C3=A9, 09-03-2005 a las 14:06 +0100, Klaus Boehm escribi=C3=B3: > >> > >>>ama...@ub... wrote: > >>> > >>>>Klaus Boehm wrote: > >>>> > >>>> > >>>>>i try to connect to a oracle db. > >>>>>this db runs on another server. > >>>>>now i have problem with the connect string. > >>>>> > >>>>>connect([user, password, dsn, mode, handle, pool, threaded, twopha= se]) > >>>>> > >>>>>how looks the dsn if i try to connect from a remote box? > >>>> > >>>> > >>>>If you know how to connect with sql*plus, you've already typed a > >>>>connection string like "<user>/<password>@<dsn>". So it's easy. > >>>> > >>>> > >>>>Else, you must know the name of the server, and the name of the dat= abase > >>>>on the server (the service name). > >>>> > >>>>If you installed the Oracle client version 10g, the dsn is simply > >>>>dsn =3D "<server>/<service>" > >>>> > >>>>With a 8i or 9i Oracle client, it's more complicated: > >>>>dsn =3D "(DESCRIPTION=3D(ADDRESS=3D(PROTOCOL=3DTCP)(HOST > >>>>=3D<server>)(PORT=3D1521))(CONNECT_DATA=3D(SERVICE_NAME=3D<service>= )))" > >>>>(All in one string, you may add spaces if you want) > >>>>You may want to have a (short) alias for this long string, in this = case > >>>>you must edit the tnsnames.ora file. But this is another story. > >>>> > >>>>Hope this helps, > >>>> > >>>>-- > >>>>Amaury Forgeot d'Arc > >>>> > >>>> > >>>> > >>>> > >>>>------------------------------------------------------- > >>>>SF email is sponsored by - The IT Product Guide > >>>>Read honest & candid reviews on hundreds of IT Products from real u= sers. > >>>>Discover which products truly live up to the hype. Start reading no= w. > >>>>http://ads.osdn.com/?ad_id=3D6595&alloc_id=3D14396&op=3Dclick > >>>>_______________________________________________ > >>>>cx-oracle-users mailing list > >>>>cx-...@li... > >>>>https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > >>>> > >>> > >>>Now i have the correct dsn. > >>> > >>> > >>> dsn =3D > >>>"(DESCRIPTION=3D(ADDRESS_LIST=3D(ADDRESS=3D(PROTOCOL=3DTCP)(HOST=3D'= db-os.dmg.ewt.de')(PORT=3D1521)))(CONNECT_DATA=3D(SID=3DOSPROD)))" > >>> > >>>connection =3D cx_Oracle.connect("xxxx", "yyyy", dsn) > >>> > >>>i get the following error: > >>> > >>>RuntimeError: Unable to acquire Oracle environment handle > >>> > >>>have anyone a idea? > >>> > >>> > >>>Klaus > >>> > >> > >>------------------------------------------------------- > >>SF email is sponsored by - The IT Product Guide > >>Read honest & candid reviews on hundreds of IT Products from real use= rs. > >>Discover which products truly live up to the hype. Start reading now. > >>http://ads.osdn.com/?ad_ide95&alloc_id=14396&opclick > >>_______________________________________________ > >>cx-oracle-users mailing list > >>cx-...@li... > >>https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > >> > >=20 > >=20 > >=20 > > ------------------------------------------------------- > > SF email is sponsored by - The IT Product Guide > > Read honest & candid reviews on hundreds of IT Products from real use= rs. > > Discover which products truly live up to the hype. Start reading now. > > http://ads.osdn.com/?ad_ide95&alloc_id=14396&op=3Dclick > > _______________________________________________ > > cx-oracle-users mailing list > > cx-...@li... > > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > >=20 >=20 >=20 > --=20 > --------------------------------------------- > Klaus Boehm > Systemadministrator > ewt gmbh > D-86152 Augsburg, Volkhartstr. 4-6 > Phone: +49.(0)821.3106-319 > Fax: +49.(0)821.310660-319 > mailto:k....@ew... > http://www.ewt.de > http://www.surf-club.de > --------------------------------------------- >=20 >=20 >=20 >=20 >=20 > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users= . > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=3D6595&alloc_id=3D14396&op=3Dclick > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |