11 Replies Latest reply on May 21, 2012 9:34 AM by EJP

    Does Oracle 11gR2 actually support IPV6?

    937637

      hi,the oracle company has declared that 11g R2 has support IPV6 and ojdbc6.jar is the right one.
      but when I test it .I get exception,have you solved that?
      my test code is:
      import java.sql.SQLException;
      import java.util.Properties;
      public class Test {
      final static String sDBDriver = "oracle.jdbc.driver.OracleDriver";
      /**
      * @param args
      * @throws SQLException
      */
      public static void main(String[] args) throws SQLException {
      // TODO Auto-generated method stub
      java.sql.Connection conn=null;

      String url="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=[fe80::b056:5cff:fe78:b672])(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=fnstdb1))";
      try
      {
      Class.forName(sDBDriver);
      conn = DriverManager.getConnection(url,"scott","fnst1234");
      }
      catch (Exception e)
      {
      System.out.println("ERROR:"+e.getMessage());
      }
      finally
      {
      System.out.println("连接是否关闭:"+conn.isClosed());
      conn.close();
      }
      }

      }
      and I use the following cmd:

      java -cp ojdbc6.jar -Djava.net.preferIPv6Addresses=true Test

      but the result is:ERROR:NL Exception was generated

      what is wrong?????

        • 1. Re: Does Oracle 11gR2 actually support IPV6?
          gimbal2
          Well you could start by trying out a normal JDBC url.

          http://www.orafaq.com/wiki/JDBC
          • 2. Re: Does Oracle 11gR2 actually support IPV6?
            EJP
            .I get exception,have you solved that?
            What exception? Solved what?
            the result is:ERROR:NL Exception was generated
            What exception?
            • 3. Re: Does Oracle 11gR2 actually support IPV6?
              jschellSomeoneStoleMyAlias
              934634 wrote:
              what is wrong?????
              If it was me I would
              - Print out the entire exception stack trace
              - Fix the connection string which is missing a closing paren.
              - try it without the square brackets.
              - verify the format of the address.
              1 person found this helpful
              • 4. Re: Does Oracle 11gR2 actually support IPV6?
                937637
                NL Exception...
                • 5. Re: Does Oracle 11gR2 actually support IPV6?
                  937637
                  sorry ,the document of oracle actually does miss a paren!I just copy it from the document ,

                  I have try the code by remove the blanket,
                  and try almost every possiablity.the following are:

                  1.jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl)))
                  the exception is:java.sql.SQLException: Listener refused the connection with the following error:
                  ORA-12514, TNS:listener does not currently know of service requested in connect descriptor

                  2.jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=[localhost])(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl)))
                  the exception is:Caused by: java.net.UnknownHostException: [localhost]
                       at java.net.InetAddress.getAllByName(InetAddress.java:1081)
                       at java.net.InetAddress.getAllByName(InetAddress.java:1019)
                       at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:114)
                       at oracle.net.nt.ConnOption.connect(ConnOption.java:123)
                       at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:337)
                  3.jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=[fe80::221:97ff:fe66:1fa9])(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl)))
                  the exception is:java.sql.SQLException: The Network Adapter could not establish the connection
                       at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
                       at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
                       at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
                       at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
                       at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
                       at java.sql.DriverManager.getConnection(DriverManager.java:582)
                       at java.sql.DriverManager.getConnection(DriverManager.java:185)

                  4.jdbc:oracle:thin:@[localhost]:1521:orcl
                  OK!
                  5.jdbc:oracle:thin:@[fe80::221:97ff:fe66:1fa9]:1521:orcl
                  the exception is:java.sql.SQLException: The Network Adapter could not establish the connection
                       at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
                       at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
                       at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
                       at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
                       at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
                       at java.sql.DriverManager.getConnection(DriverManager.java:582)
                       at java.sql.DriverManager.getConnection(DriverManager.java:185)
                       at Test.main(Test.java:22)
                  Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
                       at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:359)
                       at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:422)
                       at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:672)
                       at oracle.net.ns.NSProtocol.connect(NSProtocol.java:237)
                       at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
                       at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
                       ... 7 more
                  Caused by: java.net.ConnectException: Connection refused: connect
                       at java.net.PlainSocketImpl.socketConnect(Native Method)
                       at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
                       at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
                       at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
                       at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
                       at java.net.Socket.connect(Socket.java:529)
                       at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:141)
                       at oracle.net.nt.ConnOption.connect(ConnOption.java:123)
                       at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:337)
                       ... 12 more
                  Exception in thread "main" java.lang.NullPointerException
                       at Test.main(Test.java:31)
                  ERROR:The Network Adapter could not establish the connection

                  Can anybody solve this?
                  • 6. Re: Does Oracle 11gR2 actually support IPV6?
                    EJP
                    Connection refused: connect
                    This only has two meanings: either there is nothing listening at the host:port you specified, or an intervening firewall has kicked you out.
                    1 person found this helpful
                    • 7. Re: Does Oracle 11gR2 actually support IPV6?
                      937637
                      sound good ,but when I set the listener.ora and tnsname.ora ,for example
                      LISTENER =
                      (DESCRIPTION_LIST =
                      (DESCRIPTION =
                      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
                      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
                           (ADDRESS = (PROTOCOL = TCP)(HOST = [fe80::221:97ff:fe66:1fa9])(PORT = 1521)) ----->(or remove the blanket ,also fail!)
                      )
                      )
                      as result,in the cmd line:LSNRCTL start ,but failure,I feel that LSNRCTL does not support IPV6 address!
                      • 8. Re: Does Oracle 11gR2 actually support IPV6?
                        EJP
                        Hard to believe. You can see easily enough via netstat -anp tcp on the host where Oracle is running.
                        • 9. Re: Does Oracle 11gR2 actually support IPV6?
                          handat
                          934634 wrote:
                          sound good ,but when I set the listener.ora and tnsname.ora ,for example
                          LISTENER =
                          (DESCRIPTION_LIST =
                          (DESCRIPTION =
                          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
                          (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
                               (ADDRESS = (PROTOCOL = TCP)(HOST = [fe80::221:97ff:fe66:1fa9])(PORT = 1521)) ----->(or remove the blanket ,also fail!)
                          )
                          )
                          as result,in the cmd line:LSNRCTL start ,but failure,I feel that LSNRCTL does not support IPV6 address!
                          It is not the brackets that is the problem but your ipv6 address. Replace the :: with :0:0:
                          Do a ping6 on it and see whether it can understand the address.

                          ie
                          ping6 fe80::221:97ff:fe66:1fa9 will result in an invalid argument error
                          ping6 fe80:0:0:221:97ff:fe66:1fa9 should start pinging if the host is actually available and reachable (and ping traffic is not blocked)
                          1 person found this helpful
                          • 10. Re: Does Oracle 11gR2 actually support IPV6?
                            937637
                            hello everyone,I have solved this problem .the following shows what have I done:

                            【procedure】
                            1.edit $DB_HOME\NETWORK\ADMIN
                            \listener.ora file to allow the oracle to listen on the ip and port. for example:
                            (ADDRESS = (PROTOCOL = TCP)(HOST = [fe80::221:97ff:fe66:1fa9%4])(PORT =
                            1521))

                            2.reatart the listener ,open the cmd :
                            LSNRCTL stop/start

                            3 in some applications(javase,connection-pool,lookup)use ojdbc6.jar
                            url="jdbc:oracle:thin:@[fe80::221:97ff:fe66:1fa9]:1521:orcl";

                            4.the result is successful!!
                            【Demo】
                            1.the ip address in listener.ora must add "%4" ,or it will fail.
                            2.ipv6 address must in "["and "]",or it will fail.
                            3.the document of oracle declares that using ipv6 must set the jvm options
                            java.net.preferIPv6Addresses=true
                            but It does not matter whether it sets or not!
                            • 11. Re: Does Oracle 11gR2 actually support IPV6?
                              EJP
                              1.the ip address in listener.ora must add "%4" ,or it will fail.
                              Unlikely. Maybe it has to add the appropriate netmask, but I find that hard to believe too.
                              2.ipv6 address must in "["and "]",or it will fail.
                              Correct. Otherwise you don't have a valid IP address at all.