4 Replies Latest reply: Jun 3, 2013 8:34 PM by jschellSomeoneStoleMyAlias RSS

    Changes to JDBC Thin URL (: vs /)

    alexnarayanan

      Since 10g, the JDBC Thin URLs have been documented to take the form jdbc:oracle:thin:scott/tiger@//myhost:1521/myservicename. However the old style URLs which uses : instead of / (for example jdbc:oracle:thin:scott/tiger@myhost:1521:myservicename) continues to work even in Oracle 11g.

      Do we know if the support for the old style URLs will be taken off anytime so. There is no document suggesting this, but more & more examples and documentation seem to point towards the / style strings.
      One exception case is when the target database is running under Real Application Cluster environment, where-in the old style URLs doesn't work.

      Thanks for your help.
      Alex

        • 1. Re: Changes to JDBC Thin URL (: vs /)
          rp0428
          Welcome to the forum!
          >
          Since 10g, the JDBC Thin URLs have been documented to take the form jdbc:oracle:thin:scott/tiger@//myhost:1521/myservicename. However the old style URLs which uses : instead of / (for example jdbc:oracle:thin:scott/tiger@myhost:1521:myservicename) continues to work even in Oracle 11g.
          >
          What does 'continues to work even in Oracle 11g' mean? The URL syntax is specific to the JDBC driver jar version being used, not the version of the database.
          >
          Do we know if the support for the old style URLs will be taken off anytime so. There is no document suggesting this, but more & more examples and documentation seem to point towards the / style strings.
          One exception case is when the target database is running under Real Application Cluster environment, where-in the old style URLs doesn't work.
          >
          No one but Oracle knows.

          Oracle 9i was the last version to document the old-style syntax using a colon to separate the database name.

          You should use the documented syntax for the version of the JDBC driver that is being used. As you noted since 10g that has been to use the forward slash.

          It is also recommended to use DataSource. That class has 'setters' to set the properties (e.g. 'setDatabaseName') and the syntax issue doesn't even arise.

          Sounds like you may already have read the 'Database URLs and Database Specifiers section of the JDBC Dev Guide but for others who haven't:
          http://docs.oracle.com/cd/B28359_01/java.111/b31224/urls.htm#BEIJFHHB
          • 2. Re: Changes to JDBC Thin URL (: vs /)
            alexnarayanan
            Thanks. Yes, I meant that I am using w/ the Oracle drivers only.

            Thanks for the response, I didn't see very many responses. I guess we will have to switch to the new URLs. Strangely though the the 11.2's JDBC driver's README.txt (ORACLE_HOME\jdbc\README.txt) still refers to the old URL and doesn't talk about the new style at all. Very confusing documenation.
            • 3. Re: Changes to JDBC Thin URL (: vs /)
              gimbal2
              A readme is not proper documentation; generally nobody is responsible for keeping them up to date, so they contain stale information. Stick to the official documentation.

              You have two basic choices.

              1) it ain't broke yet, don't fix it
              2) it ain't broke yet, but fix it anyway to conform to online specs

              Me I'd take the plunge and go ahead and fix it in a moment where you have the breathing space to do so. That's a whole lot better than having to do it when you no longer have the choice and you have to get a critical high priority life or death release out the door at the same time.
              • 4. Re: Changes to JDBC Thin URL (: vs /)
                jschellSomeoneStoleMyAlias
                rp0428 wrote:
                You should use the documented syntax for the version of the JDBC driver that is being used. As you noted since 10g that has been to use the forward slash.
                Or use a single source configuration to get the database url from. Then the exact format wouldn't matter either.