Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-71

Database isn't auto-selected when connecting over SSL

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.1.5
    • 1.1.6
    • None
    • None

    Description

      Based on CONJ-64, I've tried to set up my MySQL Server with a self-signed certificate and use the MariaDB Java Client 1.1.5 to connect to it.
      I'm using the following code:

      public static void main(String[] args)
      {
        try
        {
          Class.forName("org.mariadb.jdbc.Driver").newInstance();
          String url = "jdbc:mysql://localhost:3306/test";
       
          Properties info = new Properties();
          info.setProperty("user",  "root");
          info.setProperty("password", "");
          info.setProperty("serverSslCert", "C:\\cert.pem");
          info.setProperty("useSSL", "true");
       
          Connection conn = DriverManager.getConnection(url, info);
          Statement st = conn.createStatement();
          st.executeQuery("SELECT * FROM tbl");
          
          conn.close();
        }
        catch (ClassNotFoundException ex) {System.err.println(ex.getMessage());}
        catch (IllegalAccessException ex) {System.err.println(ex.getMessage());}
        catch (InstantiationException ex) {System.err.println(ex.getMessage());}
        catch (SQLException ex) {System.err.println(ex.getMessage());}
      }

      The database "test" exists and contains a table called "tbl".
      When I run this code, it throws an exception at executeQuery stating "No database selected". All works well when commenting out setProperty("useSSL", "true"). I can also "fix" the problem by changing the SQL query to "SELECT * FROM test.tbl", but this is really not what I want.

      This issue is independent of the MySQL Server as I've tried it with 5.0.67-community-nt and 5.5.34-0ubuntu0.12.04.1. Both have been set up with the same SSL certificate.

      Attachments

        Issue Links

          Activity

            People

              georg Georg Richter
              Colin Finck Colin Finck (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.