Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8271450

Confusing error message when including a trailing "/" in a database URL

    XMLWordPrintable

Details

    • x86_64
    • linux
    • Not verified

    Description

      ADDITIONAL SYSTEM INFORMATION :
      Java --version: openjdk 11.0.12 2021-07-20, OpenJDK Runtime Environment (build 11.0.12+7), 64-Bit Server VM (build 11.0.12+7, mixed mode)

      uname -a: Linux Lenny 5.13.4-arch1-1 #1 SMP PREEMPT Tue, 20 Jul 2021 16:58:51 +0000 x86_64 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      When creating a Connectiong-object using the DriverManager.getConnection()-method one needs to supply at least a database URL. If this is not present, a an SQLException is thrown and the error message informs that a database needs to be specified. Also, if the user provides an incorrect database username and/or credentials another SQLException informs about an access denied exception.

      However, if one where to add a trailing "/" character to the database URL, such as "jdbc:mariadb://localhost/test/" instead of "jdbc:mariadb://localhost/test" the error message is quite confusing. The message states an access denied exception to the database "test/", which indicates an error regarding the username and/or credentials and not (as I think would make more sense) an incorrect database URL. Either the URL parser should be insensitive to trailing "/", or the error message should indicate an incorrect database URL.


      Attachments

        Activity

          People

            lancea Lance Andersen
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: