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

[Feature Request] fallback to socket connection if other type requested and fails

    XMLWordPrintable

Details

    • Task
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Won't Do
    • None
    • N/A
    • configuration
    • None

    Description

      For applications to work across platforms it would be useful to have a preferred connection type and to configure for this but for the protocol to fall back to socket connections if the preferred connection type doesn't work. For example I'd like domain sockets to be used on Unix systems but my software is also used on Windows systems where these aren't available. So my suggestion is to change the create socket code in MySQLProtocol at line 245 to the following:

      // Create socket with timeout if required

      String stype = null;
      String sname = null;
      Options opts = jdbcUrl.getOptions ();

      try
      {
      stype = "pipe"; sname = opts.pipe; if (sname != null) socket = new org.mariadb.jdbc.internal.mysql.NamedPipeSocket (host, sname); else {
      stype = "localSocket"; sname = opts.localSocket; if (sname != null) socket = new org.mariadb.jdbc.internal.mysql.UnixDomainSocket (sname); else {
      stype = "sharedMemory"; sname = opts.sharedMemory; if (sname != null) socket = new SharedMemorySocket (sname);}}
      }

      catch (Exception e)

      { System.out.println ("Failed to create " + stype + " '" + sname + "' with error: " + e.toString ()); System.out.flush (); }

      if (socket == null)

      { socket = socketFactory.createSocket (); }

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            GeoffreyR Geoffrey Rutherford
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.