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

regression : Pool connection may fail to connect with good user

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 1.5.0-RC, 1.5.1-RC
    • 1.5.2
    • Other
    • None

    Description

      Using MySQLDataSource or MariaDbDataSource to connect from pool has a regression :

      MariaDbDataSource datasource = new MariaDbDataSource();
      datasource.setUser("USER");
      datasource.setPassword("PWD");
      datasource.setUrl("jdbc:mariadb://localhost:3306/db");

      Connection will use current current windows user (if using windows), not user "USER1"

      MariaDbDataSource datasource = new MariaDbDataSource();
      datasource.setUser("USER");
      datasource.setPassword("PWD");
      datasource.setUrl("jdbc:mariadb://localhost:3306/db?user=USER1");

      Connection will use user "USER1"


      recommended way to connect a pool is using Driver implementation, not DataSource
      example :
      final HikariDataSource ds = new HikariDataSource();
      ds.setMaximumPoolSize(20);
      ds.setDriverClassName("org.mariadb.jdbc.Driver");
      ds.setJdbcUrl("jdbc:mariadb://localhost:3306/db");
      ds.addDataSourceProperty("user", "root");
      ds.addDataSourceProperty("password", "myPassword");
      ds.setAutoCommit(false);

      Attachments

        Activity

          People

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