Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

DBI connect to IPv6

by daphnaw (Acolyte)
on Mar 02, 2011 at 09:58 UTC ( #890934=perlquestion: print w/replies, xml ) Need Help??

daphnaw has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I'm trying to add support for IPv6, but keep failing when connecting via DBI:
DBI connect('host=2001:db8:c18:2:250:56ff:fead:2d92;sid=anadb;port=152 +1','ana38_admin',...) failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOM +E (Linux) env var or PATH (Windows) and or NLS settings, permissions +, etc. at
I've tried adding the sqaure brackets [], with no success:
DBI connect('host=[2001:db8:c18:2:250:56ff:fead:2d92];sid=anadb;port=1 +521','ana38_admin',...) failed: ERROR OCIEnvNlsCreate. Check ORACLE_H +OME (Linux) env var or PATH (Windows) and or NLS settings, permissio +ns, etc.
Or "" :
DBI connect('host="2001:db8:c18:2:250:56ff:fead:2d92";sid=anadb;port=1 +521','ana38_admin',...) failed: ERROR OCIEnvNlsCreate. Check ORACLE_H +OME (Linux) env var or PATH (Windows) and or NLS settings, permissio +ns, etc.
Any ideas?

Replies are listed 'Best First'.
Re: DBI connect to IPv6
by afoken (Canon) on Mar 02, 2011 at 10:53 UTC

    Your posted connect arguments lack the "dbi:" prefix and the name of the DBD. And if you had wrapped the connect statements in <code> tags, the version with brackets would show correctly. See Markup in the Monastery.

    From the error messages I guess that you are using Oracle and DBD::Oracle.

    Is there any reason why you don't let Oracle take care of selecting the protocol, host, port, SID, ...? Create a record in TNSNAMES.ORA for the database and use the name of that record instead of messing with host, sid, and port parameters. Did you check if your version of Oracle supports IPv6? 30 seconds using Google tell me that you need at least Oracle 11g to have IPv6 support.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      I've upgraded the sqlplus libraries we have been using from 10.2.0.3 to 11.2 (oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64.zip & oracle-instantclient11.2-sqlplus-11.2.0.1.0-1.x86_64.zip), so, yes I'm aware only 11.2 supports IPv6.

      Connecting directly to sqlplus does work:

      sqlplus system/manager@"[2001:db8:c18:3:214:4fff:fef2:30c1]:1521/anadb +"

      Any other ideas?
        Any other ideas?
        1. Use TNSNAMES.ORA
        2. Use TNSNAMES.ORA. Really. Don't hardcode database connections, use the standard configuration file TNSNAMES.ORA.
        3. Configure the machine running perl to resolve some arbitary hostname to the desired IPv6 address, e.g. by editing /etc/hosts / %windir%\system32\drivers\etc\hosts or by adding an AAAA record to your local DNS server, and use that hostname instead of the IPv6 address.
        4. Look at the DBD::Oracle documentation, especially "the usual suspects" README*.*, CHANGES, NOTES, TODO.
        5. Look at the source of DBD::Oracle to find out how the connect parameters are handled. Especially trace the way of the host parameter, watch out for calls to routines that can't handle IPv6 addresses.
        6. Write a patch for DBD::Oracle, including tests, and send it to the DBD::Oracle maintainer.

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://890934]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2019-09-22 18:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (273 votes). Check out past polls.

    Notices?