Oracle::DBI module - Issues in connecting to Oracle 10G

Hello,

Can someone help with me a DBI issue I'm having in connecting to an Oracle 10g DB server?

We have production scripts that loads data into DB (oracle9i) using DBI module. We recently migrated our database to oracle 10g. Our DBA has implemented load balancing on this 10g server and gave us the new tnsnames entry as... 

hoststring.10G =
  (DESCRIPTION=
    (LOAD_BALANCE=yes)
       (ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.123)(PORT=1521))
       (ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.124)(PORT=1521))
    (CONNECT_DATA=
       (SERVICE_NAME=xxxx)
    )
  )

Currently, using the DBI module I am able to connect to these servers (x.x.x.123 & x.x.x.124) individually using the following code...

my $db_conn_dsn = "dbi:Oracle:host=HOSTNAME;port=PORTNUMBER;sid=SID";
my $db_conn_user= "XXXXX";
my $db_conn_pass= "XXXXX";

my $dbh = DBI->connect($db_conn_dsn,$db_conn_user,$db_conn_pass,{ RaiseError => 1, AutoCommit => 0 } );

But I want to connect to the load balanced configuration instead of connecting to the servers separately. Is there any way I can refer to the host string ("hostname.10G") in tnsnames.ora file for DBI module connection information. Finally, I want to use the load balanced configuratin rather than connecting to individual servers.

Any help in this regard is greatly appreciated.

Thanks & Regards
Srinu


      

1
write2srinu
1/9/2009 10:31:28 PM
perl.dbi.users 11099 articles. 1 followers. Follow

2 Replies
827 Views

Similar Articles

[PageSpeed] 42

--_7bc1e4b9-60a5-45d0-9a97-d391708f0d4d_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable


Sri-
Oracle connects via the TNS entry as seen in %ORACLE_HOME%/network/admin/tn=
snames.ora
Here the TNS Name DB1 is associated to Service IDentifier of DB 1 SID=3DDB1
which in this case is listening on localhost Port 1521

DB1=3D=20
      (DESCRIPTION=3D
          (ADDRESS=3D
        (PROTOCOL=3Dtcp)
        (HOST=3Dlocalhost)
        (PORT=3D1521)
          )
         (CONNECT_DATA=3D
                (SERVER =3D DEDICATED)
        (SID=3DDB1)
        (SERVICE_NAME=3DDB1)
             )
            )

        EXTPROC_CONNECTION_DATA =3D=20
            (DESCRIPTION =3D
              (ADDRESS_LIST =3D=20
                 (ADDRESS =3D (PROTOCOL =3D IPC)(KEY =3D EXTPROC1))
              )
            (CONNECT_DATA =3D=20
                (SID =3D PLSExtProc)
                (PRESENTATION =3D RO)
             )
          )

If you are willing to configure different TNS to use different ports you *c=
an* have multiple TNS entries / localhost

Warm Regards
Martin=20
______________________________________________=20
Disclaimer and confidentiality note=20
Everything in this e-mail and any attachments relates to the official busin=
ess of Sender. This transmission is of a confidential nature and Sender doe=
s not endorse distribution to any party other than intended recipient. Send=
er does not necessarily endorse content contained within this transmission.=
=20




> Date: Fri=2C 9 Jan 2009 14:31:28 -0800
> From: write2srinu@yahoo.com
> Subject: Oracle::DBI module - Issues in connecting to Oracle 10G
> To: dbi-users@perl.org
>=20
> Hello=2C
>=20
> Can someone help with me a DBI issue I'm having in connecting to an Oracl=
e 10g DB server?
>=20
> We have production scripts that loads data into DB (oracle9i) using DBI m=
odule. We recently migrated our database to oracle 10g. Our DBA has impleme=
nted load balancing on this 10g server and gave us the new tnsnames entry a=
s...=20
>=20
> hoststring.10G =3D
>   (DESCRIPTION=3D
>     (LOAD_BALANCE=3Dyes)
>        (ADDRESS=3D(PROTOCOL=3DTCP)(HOST=3Dx.x.x.123)(PORT=3D1521))
>        (ADDRESS=3D(PROTOCOL=3DTCP)(HOST=3Dx.x.x.124)(PORT=3D1521))
>     (CONNECT_DATA=3D
>        (SERVICE_NAME=3Dxxxx)
>     )
>   )
>=20
> Currently=2C using the DBI module I am able to connect to these servers (=
x.x.x.123 & x.x.x.124) individually using the following code...
>=20
> my $db_conn_dsn =3D "dbi:Oracle:host=3DHOSTNAME=3Bport=3DPORTNUMBER=3Bsid=
=3DSID"=3B
> my $db_conn_user=3D "XXXXX"=3B
> my $db_conn_pass=3D "XXXXX"=3B
>=20
> my $dbh =3D DBI->connect($db_conn_dsn=2C$db_conn_user=2C$db_conn_pass=2C{=
 RaiseError =3D> 1=2C AutoCommit =3D> 0 } )=3B
>=20
> But I want to connect to the load balanced configuration instead of conne=
cting to the servers separately. Is there any way I can refer to the host s=
tring ("hostname.10G") in tnsnames.ora file for DBI module connection infor=
mation. Finally=2C I want to use the load balanced configuratin rather than=
 connecting to individual servers.
>=20
> Any help in this regard is greatly appreciated.
>=20
> Thanks & Regards
> Srinu
>=20
>=20
>      =20
>=20

_________________________________________________________________
Windows Live=99 Hotmail=AE: Chat. Store. Share. Do more with mail.=20
http://windowslive.com/howitworks?ocid=3DTXT_TAGLM_WL_t1_hm_justgotbetter_h=
owitworks_012009=

--_7bc1e4b9-60a5-45d0-9a97-d391708f0d4d_--
-1
mgainty
1/10/2009 1:26:47 AM
> hoststring.10G =
>  (DESCRIPTION=
>    (LOAD_BALANCE=yes)
>       (ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.123)(PORT=1521))
>       (ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.124)(PORT=1521))
>    (CONNECT_DATA=
>       (SERVICE_NAME=xxxx)
>    )
>  )
>
> Currently, using the DBI module I am able to connect to these servers (x.x.x.123 & x.x.x.124) individually using the following code...
>
> my $db_conn_dsn = "dbi:Oracle:host=HOSTNAME;port=PORTNUMBER;sid=SID";
> my $db_conn_user= "XXXXX";
> my $db_conn_pass= "XXXXX";
>
> my $dbh = DBI->connect($db_conn_dsn,$db_conn_user,$db_conn_pass,{ RaiseError => 1, AutoCommit => 0 } );
>
my $db_conn_dsn='dbi:Oracle:hoststring.10G';
my $dbh=DBI->connect($db_conn_dsn,$db_con_user,$db_con_pass,{AutoCommit=>0,RaiseError=>1})

should do the trick.  Simply replace "host=....;sid=SID" with the tnsalias 
that your dba provides you.  Make sure the TNS_ADMIN env is set to point 
to the location of the tnsnames.ora and should be fine.

Michael

-- 
 		---//---
Time flies like the wind. Fruit flies like bananas.
 	--- Groucho Marx

Either write something worth reading or do something worth writing.
 	--- Benjamin Franklin

A meeting is an event at which the minutes are kept and the hours are lost
1
mnhan
1/12/2009 3:53:16 PM
Reply:

Similar Artilces:

DBI/DBD::Oracle and Oracle 10g
------=_NextPart_000_004B_01C68019.4E9B0DC0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Should it be necessary to recompile DBI and/or DBD::Oracle when upgrading from Oracle 9.2.0.4.0 to 10.2.0.2.0? Our DBA's recently did this upgrade, and since then, I've been unable to get DBI working 100%. The lingering problem is that I cannot select character fields. If I do "select varchar2_col from random_table" using DBI, I receive back "ORA-03106: fatal two-task communication protocol error". Doing "select sy...

DBI->connect(dbi:Oracle SUCCESS
Hi all, I would like to heartly thank all of you for your assistance, esp David Davisson and Michael Chase. I am finally able to DBI connect to Oracle 8.0.5 running on Linux 2.1.14-5.0 (RedHat 6.2). In the end it was something as simple as configuring the DBI->connect statement correctly. According to "Programming the Perl DBI" by Alligator Descartes & Tim Bunce (creator of Oracle DBI) there are 3 possible syntaxes for the command: dbi:Oracle:tnsnames dbi:Oracle:sidname dbi:Oracle:host=hostname;sid=sid In my environment the 1st 2 do not work. I n...

Unable to DBI->Connect(dbi:Oracle...)
Hi, I have been trying to DBI->connect(dbi:Oracle ...) for several weeks now and still unable to make the connection. I am running Oracle 8.0.5 on a Linux 2.2.14-5.0 (RedHat 6.2) server. I can ODBC into Oracle from a client w/ no problem. I can DBI->connect(dbi:MySql ...) w/ no problem. But when I try to DBI->connect to Oracle I get the message that it can't load '/usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/Oracle/Oracle.so' and that the following does not exist /usr/lib/perl5/5.00503/i386-linux/DynaLoader.pm Both of these do exist and ...

Identifying the server connected to via DBI->connect("dbi:Oracle:")
I've written some perl that, given a TNS alias, will get the hostname from the effective tnsnames.ora file. My problem is I don't know how to get the hostname if the client's using Oracle*Names. For such a configuration there is no tnsnames.ora file to parse. Is there something in DBI or DBD::Oracle that reveals components of the TNS alias description? If not, is there some API that would allow someone to retrieve the TNS alias description from 'the master' (i.e., an Oracle*Names server)? If there is such an API and no one has written a perl wrapper for it, I'...

Oracle 10g database and DBI connectivity
Perl experts, I've got DBI and Apache configured to connect to an Oracle 9.2 database. I'm considering upgrading the database to 10g. Not expecting any problems but if anyone has gone that route and are willing to share any gotchas or additional suggestions i'd certainly appreciate it. Thanks, Kevin ...

how to implement login module using Oracle 10g database (logic & Oracle 10g Queries) and how can i use membership and roles with Oracle 10g & VS 2.0
 Hi all, Can any one tell me how to implement login module using Oracle 10g database (logic & Oracle 10g Queries) and how can I use membership and roles with Oracle 10g & vs 2.0. , for implement this is it compulsory to install oracle 10g server on the same machine on which I'm implementing this task  or otherwise i can use  other system as a server (like remote login or client server)  Hi,You should have the Oracle 10g Server or Client In your machine.In Case Client is in your Machine then Server Must be somewhere,that is enough to use.I hope then we ...

Oracle 10G Connectivity with DBI and DBD in UNIX
Hi, In my application, I am using perl version 5.6.1. I am currently using Oracle 9i database and I am using DBI and DBD modules for connecting the application to Oracle . Current Configuration of DBI and DBD: DBI v1.28=20 DBD-Oracle v1.15=20 Now I need to migrate my application to Oracle 10G. I would like to know, whether is it necessary to install the latest DBD (DBD-Oracle v1.18a) to connect to Oracle 10G or is it fine to use the current version itself. Also, please let me know, if DBD-Oracle v1.18a is supported with perl 5.6.1 or is upgradation really required. Thank...

DBI:ORACLE with Oracle XE
------=_NextPartTM-000-99957c03-451e-47b6-8999-683ef68fc006 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C69FB3.69C5A240" ------_=_NextPart_001_01C69FB3.69C5A240 Content-Type: text/plain I can connect to an Oracle XE database with dbi:ODBC using : $dbh = DBI->connect("dbi:ODBC:PSTORA01", "uid", "pwd") or die DBI::errstr; But am unable to connect with dbi:ORACLE using : $dbh = DBI->connect("dbi:Oracle:PSTORA01", "uid", "pwd") or die DBI::errstr; Each time...

DBI Oracle connection
Dear Representative, I am on Windows 2000. I've install ActivePerl and got the ppm utility to work by going to the bin directory and typing ppm3-bin.bat When I try to install the DBI, I get a error: ppm> install DBI.pm Error: connect: Unkown error Can you direct me on how to work this issue? Thanks Bev Thorson Adaptis Inc. 1100 Olive Way, 17th Floor Seattle, WA 206.342-7481 Bev, Try dropping the .pm from the name. So you'd just use 'install DBI'. William -- Lead Developer Knowmad Services Inc. || Internet Applications & Databa...

Problems using an old version of DBI to connect to a remote Oracle 10g database
------_=_NextPart_001_01C7333E.A1E7ABF9 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Dear all, Appreciate if someone can help me with this. I have a Solaris 5.6 Generic_105181-33 box on which I have Perl version 5.005_03. I also have Perl modules DBI (version 1.14) and DBD::Oracle (version 1.06 - I think?? - how can I check this?) I am using the following string to connect to a remote Oracle 10g instance: my $dbh =3D DBI->connect ("dbi:Oracle:$environment",$nsm_login,$nsm_password) || die "Unable to ...

DBI connects to one oracle instance but cannot connect to others
We run Oracle 10g under Linux. There are seven database instances: prod, tmp1,...,tmp6. The TNSNAMES.ORA file treats all seven instances equally: prod = (DESCRIPTION= (ADDRESS_LIST= (ADDRESS= (COMMUNITY = tcp.world) (PROTOCOL=tcp) (HOST=localhost) (PORT=1521) ) ) (CONNECT_DATA = (SERVER = DEDICATED) (SID = prod) ) ) ..... identical segments for the tmp1 - tmp6 instances I can sqlplus into any instance. I can run a local perl script to connect to the production instance "prod"....

test DBD::Oracle DBI connect('','user/password@database',...) failed: ORA-12154
--0-621501335-1235620987=:55352 Content-Type: text/plain; charset=us-ascii I can connect to the database using sqlplus as user oracle, but not as root. I can compile DBD::Oracle but not complete the test. I tried to set variables properly: ORACLE_HOME=/u/oracle/10.2.0 ORACLE_HOST=hostname ORACLE_PORT=1522 ORACLE_SID=databasename ORACLE_USERID=user/password@databasename PATH=/u/oracle/10.2.0/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin PWD=/usr/src/pub/dbd-oracle/DBD-Oracle-1.22 TNS_ADMIN=/u/or...

dbi:oracle on windows2000 (IIS) Oracle Problem
Hi All, I have a very similar problem to Bob Reuss where my script works ok on the DOS command line but fails in the browser. My working environment is just like his (using Perl/CGI on a windows2000 machine running IIS to connect to an Oracle DB on a Sun WkStation) except that I use the Oracle Driver instead of ODBC driver. However, I did get this error on the browser: ======================================================================== Software error: install_driver(Oracle) failed: Can't load 'C:/Perl/site/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: ...

Severe DBI-Oracle DBI-ODBC Problem
--part1_7d.460bcdd0.2d55394f_boundary Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Emergency assistance - This should never be so difficult! ? All day working switching between the 2 activestate binary installation versions from activestate site & DBD/DBI versions.  No headway connecting to oracle via perl DBI.  Windows 2k - new system. Everything newly installed for this PC.  I do not see an activestate 6.xx binary at the activestate site ?   Uninterested...

[Oracle] DBI: Oracle client libs necessary ??
Hi this is just a question for my understanding: Does the perl-dbi module depends/needs the oracle client library installation (at least) or does connecting to oracle databases on remote hosts work without it ? ty Markus It needs at least the Oracle SQL*Net software to connect to remote hosts. To build, it also needs either Oracle's Pro*C or OCI. -- Mac :}) ** I normally forward private database questions to the DBI mail lists. ** Give a hobbit a fish and he'll eat fish for a day. Give a hobbit a ring and he'll eat fish for an age. ----- Original Message ----- ...

Web resources about - Oracle::DBI module - Issues in connecting to Oracle 10G - perl.dbi.users

Resources last updated: 12/3/2015 8:21:56 PM