I was playing with TWO_TASK myself this morning and like Tom, I cannot make the advice in DBD::Oracle work with Instant Client 10.2.0.3. I wonder if the description of TWO_TASK is correct or perhaps out of date wrt to newer Oracle versions. See below:

tom r wrote:
reading man DBD::Oracle gives an in depth explanation on how the TWO_TASK environment variable can be used. however, when i tried to use it in place of .tnsnames.ora nothing worked. i believe that sql*plus does not use TWO_TASK.

-----
[~] cat .tnsnames.ora
infra=(description=(address=(protocol=tcp)(host=infradb.fs.usda.gov)
(port=1521))(connect_data=(sid=iwebdb)))
[~] sqlplus 'fs_public/[EMAIL PROTECTED]'

SQL*Plus: Release 10.2.0.3.0 - Production on Wed Apr 11 10:36:04 2007

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
[~] printenv | grep TWO
TWO_TASK=T:infradb.fs.usda.gov:iwebdb

Try as I might, I cannot make T:*** work either. What does work for me is:

TWO_TASK=//xxx.easysoft.local:1521/ORACLE_SID

but none of:

TWO_TASK=T:xxx.easysoft.local:1521:ORACLE_SID
TWO_TASK=T:xxx.easysoft.local:ORACLE_SID
TWO_TASK=T:xxx.easysoft.local/ORACLE_SID

so for a totally empty DBI->connect call (and using instant client) I have the following working:

DBI_DSN=dbi:Oracle:
DBI_USER=xxx
DBI_PASS=yyy
LD_LIBRARY_PATH=/home/martin/instantclient_10_2
TWO_TASK=//xxx.easysoft.local:1521/ORACLE_SID

perl -e 'use DBI; $h = DBI->connect();'

[~] sqlplus 'fs_public/fs_public'


<snipped sqlplus output failing to connect>


in addition, it appears sql*plus doesn't even allow one to specify the connection parameters on the command line.

That is also what I found which makes me think the syntax suggested by DBD::Oracle POD for TWO_TASK may no longer be applicable for Oracle 10.

-----
[~] sqlplus 'fs_public/[EMAIL PROTECTED]/sid=iwebdb'

For me what works using your values would be:

sqlplus 'fs_public/fs_public@//infradb.fs.usda.gov/iwebdb'

<snipped sqlplus output failing to connect>

-----

unless i'm missing something here, it seems sql*plus must use the .tnsnames.ora file.

No, I don't have a tnsnames.ora file but I don't use the syntax mentioned in DBD::Oracle.

From what I can find on the net, it may be that the syntax "T:", "P:" (in fact a letter followed by a colon) at the start of the connect string tells SQL*Net to use V1 and since Oracle 7.3, SQL*Net V1 is no longer supported.

This is not the first time someone has failed to use TWO_TASK following the directions in DBD::Oracle. Although I cannot be sure of the SQL*Net V1/V2 changes in syntax I can say that the syntax I show above does work with sqlplus and DBD::Oracle since Oracle 10. I suggest the DBD::Oracle POD is changed and I am happy to provide a patch against svn tree.

Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

Reply via email to