DBI interface for Amazon SimpleDB?

2007-12-14 Thread Tim Bunce
So, who's going to be first to mash up Amazon::SimpleDB::* and
perhaps DBI::SQL::Nano into a DBI driver for Amazon's new SimpleDB
service?

http://www.amazon.com/gp/browse.html?node=342335011

Tim.


RE: ORA-12154: TNS:could not resolve the connect identifier specified

2007-12-14 Thread Loo, Peter # PHX

Hi David,

I am not familiar with the tnsnames.ora file.  Here is what they are set to.  I 
did not find anything out of the ordinary.  To answer your question about why I 
am changing the ORACLE_HOME, it is because I spawn a sqlldr using system() 
within the program.  If I don't set the ORACLE_HOME to the relevant version of 
Oracle, I get the SQL*Loader-951 and ORA-00942 errors when I spawn 
system($sqlldrCmd).

INST1.domain.com =
  (DESCRIPTION =
(ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = hostname.domain.com)(PORT = 1521))
)
(SDU = 32767)
(CONNECT_DATA =
  (SID = inst1)
)
(TDU = 32767)
  )

INST2 =
  (DESCRIPTION =
(ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = hostname.domain.com)(PORT = 1521)
)
)
(CONNECT_DATA =
  (SERVICE_NAME = inst2)
)
   )
  ) 

Thanks for all your help.
 
Peter

-Original Message-
From: David Dooling [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 12, 2007 2:01 PM
To: dbi-users@perl.org
Subject: Re: ORA-12154: TNS:could not resolve the connect identifier specified

On Wed, Dec 12, 2007 at 01:28:37PM -0700, Loo, Peter # PHX wrote:
 I tried setting both variables at the very beginning before any 
 connection is made and the result is still the same.
 
 $ENV{ora_envhp} = 0;
 $ENV{ORA_ENVHP} = 0;

Why are you switching the ORACLE_HOME at all?  The 9i client should be able to 
connect to the 10g database just fine (and vice versa).  All you need to do is 
ensure you have the appropriate entries for the 9i and 10g instances in the 
network/admin/tnsnames.ora of whatever client you are using.

Switching as you are is quite problematic since the Oracle shared libraries are 
probably only loaded once, the first time DBD::Oracle is loaded by Perl.  
Switching ORACLE_HOME and PATH (it seems you would also have to change 
LD_LIBRARY_PATH) after loading one set of shared libraries is going to lead to 
unpredictable behavior.

 -Original Message-
 From: Martin Evans [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 12, 2007 1:47 AM
 To: dbi-users@perl.org
 Subject: Re: ORA-12154: TNS:could not resolve the connect identifier 
 specified
 
 Loo, Peter # PHX wrote:
  Hello All,
   
  I am confused as to why I am getting this error message.  I am 
  trying to connect to two different Oracle instances within one program run.
  The two Oracle instances are different in versions.  inst1 is 9.2 
  while
  inst2 is 10.2.  I am able to connect to the first instance without 
  problems, but the instance yields ORA-12154 error.  However, when 
  I reverse the connection order by connecting the inst2 with 10.2 
  version first, then connecting to the inst1 with 9.2 version, there is no 
  error.
  I hope someone can shed some lite.  Here is the code:
   
  #!/usr/bin/perl
   
  use DBI;
  
  $ENV{'ORACLE_HOME'} = /opt/app/oracle/product/9.2; $ENV{'PATH'} =
  /opt/app/oracle/product/9.2/bin:/usr/ccs/bin:/opt/studio9/SUNWspro/bin:
  /opt/app/oracle/product/10.2/bin:/opt/CA/Shar
  edComponents/dmscript/bin:/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/us
  r/ lo cal/bin:/opt/app/oracle/product/8.1.7.4/bin:/usr/local/bin:/
  usr/local/apps/common/devl/bin:/usr/lbin:/usr/ccs/bin:/usr/xpg4/bin:
  /o pt /pkware:/opt/RICHPse/bin:/opt/RICHPse/examples:/opt/sas82:/o
  pt/sas82/sasexe:/opt/Navisphere/bin:/opt/fileport/bin:/opt/syncsort/bin:
  /usr/bin:/usr/openwin/bin:/opt/SUNWspro/bin:/opt/mfcobol/cob
  ol/bin:/opt/starsql/bin:/opt/uni/bin:/opt/uni/scripts:/etc:/opt/emc/
  EM Cp ower/bin/sparcv9:/etc/emc/bin:/usr/local/nz/bin/:.;
   
  my $dbh_inst1 = DBI-connect(dbi:Oracle:inst1, schema, 
  password, { RaiseError = 1, PrintError = 1});
   
  $ENV{'ORACLE_HOME'} = /opt/app/oracle/product/10.2; $ENV{'PATH'} = 
  /opt/app/oracle/product/10.2/bin:/opt/app/oracle/product/9.2/bin:/u
  sr /c cs/bin:/opt/studio9/SUNWspro/bin:/opt/CA/Shar
  edComponents/dmscript/bin:/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/us
  r/ lo cal/bin:/opt/app/oracle/product/8.1.7.4/bin:/usr/local/bin:/
  usr/local/apps/common/devl/bin:/usr/lbin:/usr/ccs/bin:/usr/xpg4/bin:
  /o pt /pkware:/opt/RICHPse/bin:/opt/RICHPse/examples:/opt/sas82:/o
  pt/sas82/sasexe:/opt/Navisphere/bin:/opt/fileport/bin:/opt/syncsort/bin:
  /usr/bin:/usr/openwin/bin:/opt/SUNWspro/bin:/opt/mfcobol/cob
  ol/bin:/opt/starsql/bin:/opt/uni/bin:/opt/uni/scripts:/etc:/opt/emc/
  EM Cp ower/bin/sparcv9:/etc/emc/bin:/usr/local/nz/bin/:.;
   
  my $dbh_inst2 = DBI-connect(dbi:Oracle:inst2, schema, 
  password, { RaiseError = 1, PrintError = 1});
   
  $dbh_inst1-disconnect();
  $dbh_inst2-disconnect();
   
  exit;
   
  Here is the error message:
   
  DBI connect('inst2','schema',...) failed: ORA-12154: TNS:could not 
  resolve the connect identifier specified (DBD ERROR: 
  OCIServerAttach)
 
 Sounds as though you have hit an issue sharing an env.
 I'm not sure as I've not done this myself but you may need to look at the 
 ora_envhp attribute:
 
 The first time a connection is made a new OCI 

Re: DBI interface for Amazon SimpleDB?

2007-12-14 Thread Dean Arnold

Tim Bunce wrote:

So, who's going to be first to mash up Amazon::SimpleDB::* and
perhaps DBI::SQL::Nano into a DBI driver for Amazon's new SimpleDB
service?

http://www.amazon.com/gp/browse.html?node=342335011

Tim.



Do you have driver prefix for it yet ? Maybe simpdb_ ?

BTW: it isn't free, altho its pretty cheap.
I'll see what I can morph from DBD::Amazon.

Dean Arnold
Presicient Corp.


Re: ORA-12154: TNS:could not resolve the connect identifier specified

2007-12-14 Thread David Dooling
On Fri, Dec 14, 2007 at 10:47:16AM -0700, Loo, Peter # PHX wrote:
 I am not familiar with the tnsnames.ora file.  Here is what they are
 set to.  I did not find anything out of the ordinary.

If both ORACLE_HOME's have the same contents in the tnsnames.ora, then
you should be able to connect to both instances using either one.

 To answer
 your question about why I am changing the ORACLE_HOME, it is because
 I spawn a sqlldr using system() within the program.  If I don't
 set the ORACLE_HOME to the relevant version of Oracle, I get the
 SQL*Loader-951 and ORA-00942 errors when I spawn system($sqlldrCmd).

I am not all that familiar with sqlldr, but I think you can supply a
username/password/instance on the command line.  So in theory it
should work too unless the loading format is different between
versions.  If you do continue to switch ORALCE_HOME and PATH, I would
definitely recommend switching LD_LIBRARY_PATH too (so sqlldr picks up
the correct shared libraries when you spawn it).

 INST1.domain.com =
   (DESCRIPTION =
 (ADDRESS_LIST =
   (ADDRESS = (PROTOCOL = TCP)(HOST = hostname.domain.com)(PORT = 1521))
 )
 (SDU = 32767)
 (CONNECT_DATA =
   (SID = inst1)
 )
 (TDU = 32767)
   )
 
 INST2 =
   (DESCRIPTION =
 (ADDRESS_LIST =
   (ADDRESS = (PROTOCOL = TCP)(HOST = hostname.domain.com)(PORT = 1521)
 )
 )
 (CONNECT_DATA =
   (SERVICE_NAME = inst2)
 )
)
   ) 
 
 -Original Message-
 From: David Dooling [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, December 12, 2007 2:01 PM
 To: dbi-users@perl.org
 Subject: Re: ORA-12154: TNS:could not resolve the connect identifier specified
 
 On Wed, Dec 12, 2007 at 01:28:37PM -0700, Loo, Peter # PHX wrote:
  I tried setting both variables at the very beginning before any 
  connection is made and the result is still the same.
  
  $ENV{ora_envhp} = 0;
  $ENV{ORA_ENVHP} = 0;
 
 Why are you switching the ORACLE_HOME at all?  The 9i client should
 be able to connect to the 10g database just fine (and vice versa).
 All you need to do is ensure you have the appropriate entries for
 the 9i and 10g instances in the network/admin/tnsnames.ora of
 whatever client you are using.
 
 Switching as you are is quite problematic since the Oracle shared
 libraries are probably only loaded once, the first time DBD::Oracle
 is loaded by Perl.  Switching ORACLE_HOME and PATH (it seems you
 would also have to change LD_LIBRARY_PATH) after loading one set of
 shared libraries is going to lead to unpredictable behavior.

-- 
David Dooling